|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-05-21 02:57 UTC] njgreen at jlonline dot com
//error source
$connid=odbc_connect('odbc_db','odbc_user','odbc_pswd');
$sql='select id from bt_article where id<>978';
$row=odbc_do($connid,$sql);
echo odbc_num_rows($row);
//result -1
//if $sql='select title from bt_article where id<>978 order by id';
//result is ok
//if $sql='select title from bt_article where id=978 order by id';
//result -1
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 07:00:01 2025 UTC |
From PHP user Matt White: The MS-SQL driver doesn't support the odbc_num_rows() function. There are several workarounds listed in the comments in the annotated manual... // Return the number of rows affected by the last query. function numberOfRowsSelected() { // Weird bug. MS-SQL's ODBC driver doesn't support the num_rows function. $NumRecords = 0; odbc_fetch_row($this->lastSqlResult, 0); while (odbc_fetch_row($this->lastSqlResult)) { $NumRecords++; } //odbc_fetch_row($this->lastSqlResult, $currentRow); return $NumRecords; }