Page 1 of 1

odbc_num_rows always returns -1

Posted: Tue May 13, 2003 4:38 pm
by princessAlbert
hi..
in the documentation it says this will happen "with many drivers"; anyone know what these are and how to resolve this?
failing that, all i need is a way to retrieve a recordcount without having to loop over the query result..
ta[/i]

Posted: Tue May 13, 2003 8:49 pm
by m3mn0n
can you give some more detail?



btw isn't Albert a guys name? =P

Posted: Wed May 14, 2003 7:09 pm
by princessAlbert
hi.. more detail.. ok:

i am using PHP 4.3.1

here's my query stuff:

$dsn="ds";
$conn=odbc_connect($dsn, "u", "pw");
$query="select * from somewhere";
$result=odbc_Exec($conn, $query);

now when i do this:

while(odbc_fetch_row($result))
{ echo "test<br>";
}

i get a list which proves records were found, but when i do this:

echo odbc_num_rows($result);

i get -1. all i want is to find the recordcount!!!

thanks



yes it is; i can't help it; i was born into it :P

Posted: Thu May 15, 2003 1:29 am
by volka
the user contributed notes at http://www.php.net/manual/en/function.odbc-num-rows.php offer some workarounds