|
Posted by BethH on 10/08/07 03:52
According to php.net, mssql_query is supposed to return true when no
rows are returned. I'm actually getting an empty resource identifier
instead of true.
The table is empty, there are no rows in it at all, so mssql_query
should always return true, but it isn't. Am I missing something?
Here's my code:
$StrQuery = "SELECT * FROM BookMarks WHERE UserName='" . $ID . "'";
$Result = mssql_query($StrQuery);
I'm not sure how I could have messed it up. I tried looking for bool-
true (=== TRUE), but it didn't catch it. So then I tried any true (==
TRUE), and it worked. So then I tried looking for a bool (is_bool)
and it didn't catch it. Finally, I had it just print the result and
it gives me a resource identifier.
It keeps trucking through as if it had actually found something. But
when I do this:
while ($Row = mssql_fetch_assoc($Result)){
[code to make a table with the data]
};
nothing happens, because, of course, there are no actual rows, only
imaginary ones.
I've changed my code to check if the array is false before starting
the while loop, but that seems like a weird way to go just to see if
there's any data to work with.
Any Suggestions?
Navigation:
[Reply to this message]
|