odbc_num_rows ??
| From: | Budgee) | Date: | Mon, 14 Aug 2000 11:03:41 +0000 |
| Subject: | odbc_num_rows ?? | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-2645@lists.php.net to get a copy of this message | ||
Howdy All
The following code had two ways of counting the number of rows
returned in a result. The first uses a loop counter, the seconf the
odbc_num_rows function. Any ideas why the second doesn't work.
It returns -1, the error code.
The database is an Access 97 DB.
The value of $rows is correct, but $num_rows is -1.
$conn = odbc_connect("glenwood","","");
$query = "select * from news";
$result = odbc_exec($conn, $query);
while($row = odbc_fetch_row($result)) {
$rows++;
}
$num_rows = odbc_num_rows($result,"id");
Warwick Chapman (1999)
Assistant IT Manager
Glenwood High School, Durban, South Africa
031 2055241
083 7797094
www.glenwoodhighschool.co.za