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

05-19-2008, 07:12 PM

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..

//echo $rows;

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

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

echo $totrows;

//echo $totrows;

Please help..


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

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 ;)