Most databases don't return the number of rows in the results of a select 
statement to odbc_num_rows. See:


Usually the way to determine the number of rows a select returns is to 
either fetch them all and count them or do an additional aggregate query. 
It depends on your requirements.
I presume that this behaviour is because in most cases the database engine 
does not make the number of rows in a result set available to the driver. 
The only way the php interface could calculate the number of rows would be 
to fetch them all which may be inefficient - say if you were only 
interested in the first row out of a possible 100. [anybody else care to 

Note, after an insert, update and delete statements odbc_num_rows does 
return the number of rows affected.

cheers Simon

On Tuesday 09 November 2004 08:09, Petrus Ali Saputra wrote:
> Here is my code:
> $conn = odbc_connect("Ta Fara","","");
> $query = "SELECT * FROM Config";
> $result = odbc_exec($conn, $query);
> echo odbc_num_rows($result);
> This code never give me a 0 result even there is some data. How can I
> solve it? Thank you.
> --
> Petrus Ali Saputra
> ==========================================================
> Addr. : Karang Empat Besar 76
>          Surabaya 60133
>          East Java, Indonesia
> Phone : 62-31-381-7866
>          62-31-6010-2653
>          62-81-23000-254
> ----------------------------------------------------------
> A professional web hosting for your business and corporate
> URL   : http://attractive.as/hostmania
> ----------------------------------------------------------
> Mau kredit mobil baru/bekas dengan bunga rendah?
> URL   : http://fantastic.as/kreditmobil

Simon Rees  |  [EMAIL PROTECTED]  |
ORA-03113: end-of-file on communication channel

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to