note 46138 added to function.odbc-num-rows
| From: | paul at mNoOvSePtAoMiNcOeSlPaMnNdO dot ScPoAmM | Date: | Thu, 30 Sep 2004 18:25:05 +0000 |
| Subject: | note 46138 added to function.odbc-num-rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-77624@lists.php.net to get a copy of this message | ||
Here's a quick and dirty function that *should* return the number of rows in a query even if
the driver is being ornery.
<?php
function better_odbc_num_rows($con,$sql){
$result = odbc_exec($con,$sql);
$count=0;
while($temp = odbc_fetch_into($result, &$counter)){
$count++;
}
return $count;
}
?>
$con is your ODBC connection, and $sql is your SQL query. Put it in your header and you should be
good to go.
----
Manual Page -- http://www.php.net/manual/en/function.odbc-num-rows.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+46138
Delete -- http://master.php.net/manage/user-notes.php?action=delete+46138&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+46138&report=yes
Search -- http://master.php.net/manage/user-notes.php