...

View Full Version : How to get total no. of rows in PHP. I'm not using mysql.



RRVARMA
05-19-2008, 07:12 PM
Hi,

Please tell me how to find the total number of rows fetched my a query. I'm getting the rows from Teradata and not using MySql.

i tried with the following but in vain..

//$rows=odbc_num_rows($query);
//echo $rows;

//$rows= "SELECT count(*) as result FROM (".$query.")";
//echo $rows;

//$num_rows = mysql_num_rows($query);
//echo $num_rows;

$totrows=odbc_fetch_row($query);
echo $totrows;

//$totrows=ROW_COUNT($query);
//echo $totrows;

Please help..

Thanks,
RRVARMA

Inigoesdr
05-19-2008, 07:33 PM
How are you querying the database?

Fou-Lu
05-19-2008, 07:36 PM
odbc_num_rows should work for you, as long as you are relating to a resource returned from an odbc_exec() call. Thats the strange part of it. Are you sure you are actually executing the query, or are you trying to pass the query as a string to the num_rows call? Another option would be to run a counter in a corelated subquery to count the results being done, but that should not be necessary....


Beaten to the punch ;)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum