note 6048 deleted from function.odbc-num-rows by jimw
| From: | jimw@php.net | Date: | Mon, 17 Dec 2001 22:32:16 +0000 |
| Subject: | note 6048 deleted from function.odbc-num-rows by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23030@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.