note 11932 deleted from function.count.php by torben
| From: | torben@php.net | Date: | Tue, 13 Mar 2001 22:23:24 +0000 |
| Subject: | note 11932 deleted from function.count.php by torben | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-12355@lists.php.net to get a copy of this message | ||
The count function does not consider the situation where one might fire an SQL query which returns
only one row ; and that row has only one column.
For example...
$sql = "select count(*) as cnt from afl_info";
$client_results = mssql_query($sql,$conn);
$client_row = mssql_fetch_array($client_results);
mssql_free_result($client_results);
if ($client_row["cnt"] == 1) {
....
in this case the query will always return 1 row, having one column; therefore the count function
will return 1. however, in the documentation , it says that if the count fn returns 1, then it means
that the variable (on which the count fn was used) is not a function.