note 6048 modified in odbc_num_rows by ronabop
| From: | ronabop@php.net | Date: | Wed, 04 Oct 2000 15:24:51 +0000 |
| Subject: | note 6048 modified in odbc_num_rows by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6057@lists.php.net to get a copy of this message | ||
If you're doing something simple, like
checking to see that a username and password
match, you can do this in Sybase or
MSSQL:
$query = "SELECT @@ROWCOUNT (SELECT Username, Password ";
$query .= "FROM Users ";
$query .= "WHERE Username LIKE '$Username' ";
$query .= "AND Password LIKE '$Password')";
$result = odbc_exec($connection, $query);
while($row = odbc_fetch_row($result)) {
$Status = (integer) odbc_result($result, 1);
}
Just check the value of $Status, and you've got your row count.
This lets the Data Store handle the row counting instead of the lowly web server.
May be nice if you want the data store to take some load off the web servers.
http://www.php.net/manual/function.odbc-num-rows.php