note 111183 added to function.odbc-num-rows
| From: | GerdChristianKunze | Date: | Wed, 23 Jan 2013 12:34:39 +0000 |
| Subject: | note 111183 added to function.odbc-num-rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-193360@lists.php.net to get a copy of this message | ||
odbc_num_rows does return -1 when it shouldn't.
i used this code:
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:
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 :-)
----
Server IP: 69.147.83.199
Probable Submitter: 88.79.240.164
----
Manual Page -- http://php.net/manual/en/function.odbc-num-rows.php
Edit -- https://master.php.net/note/edit/111183
Del: integrated -- https://master.php.net/note/delete/111183/integrated
Del: useless -- https://master.php.net/note/delete/111183/useless
Del: bad code -- https://master.php.net/note/delete/111183/bad+code
Del: spam -- https://master.php.net/note/delete/111183/spam
Del: non-english -- https://master.php.net/note/delete/111183/non-english
Del: in docs -- https://master.php.net/note/delete/111183/in+docs
Del: other reasons-- https://master.php.net/note/delete/111183
Reject -- https://master.php.net/note/reject/111183
Search -- https://master.php.net/manage/user-notes.php