Voting

: four plus four?
(Example: nine)

The Note You're Voting On

Gerd Christian Kunze
12 years ago
odbc_num_rows does return -1 when it shouldn't.

i used this code:

<?php
if( odbc_num_rows( $Result ) ) {
while(
false !== ( $Row = @odbc_fetch_array( $Result ) ) ) {
// do something with $Row
}
}
else {
return
false;
}
?>

and it didn't work... obviously

but this while loop will skip an empty result set anyway, so i use this:

<?php
while( false !== ( $Row = @odbc_fetch_array( $Result ) ) ) {
// do something with $Row
}
if( !
odbc_num_rows( $Result ) ) {
return
false;
}
?>

because after processing the $Result with fetch, odbc_num_rows reports the correct count (false|0..n) ... magic :-)

<< Back to user notes page

To Top