mssql_num_rows problem
| From: | Gary Ogilvie | Date: | Fri, 27 Jun 2003 12:35:55 +0000 |
| Subject: | mssql_num_rows problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-153102@lists.php.net to get a copy of this message | ||
Hello everyone,
I am trying to grab some data from a table in a database. Here is the
code I am using:
$myServer = "192.92.0.248";
$myUsername = "Admin";
$myPassword = "bluefish";
$myDB = "COMPANY";
$myUser = $_GET['user'];
$myPass = $_GET['pass'];
#print ("$myUser<br>$myPass");
$s = mssql_connect($myServer, $myUsername, $myPassword)
or die;
$d = mssql_select_db($myDB, $s)
or die;
$query = "SELECT * FROM users WHERE user = '$myUser'";
print ("$query");
$result = mssql_query($query)
or die;
$numRows = mssql_num_rows($result);
print ("$numRows");
When printing out the query the correct statement is being sent to
MSSQL. The variable $myUser does in face match what is in the database.
However when I print the variable $numRows I am getting a "0". So no
rows are being sent back - how can this be so when what is being sent to
the database does in fact match a record in the table. I am mostly
puzzled - PHP is set up correctly as I have been using this sort of
thing with other projects.
All help is very deeply appreciated.
Gary