Misunderstanding mssql_query in the manual
| From: | Alf Stockton | Date: | Mon, 12 Sep 2005 15:45:07 +0000 |
| Subject: | Misunderstanding mssql_query in the manual | ||
| Groups: | php.windows | ||
| Request: | Send a blank email to php-windows+get-26318@lists.php.net to get a copy of this message | ||
I am apparently misunderstanding the mssql_query entry in the manual.
The manual reads:-
Returns: A MS SQL result resource on success, *TRUE* if no rows were returned, or *FALSE* on error.
From that I believe that if I test result for TRUE I should report a no data available and if FALSE display a system errror
So my code reads:-
$SQL = sprintf("select a_date, a_time, amnt from register where mac_name = '%s' and message_id = 34 or message_id = 35 order by a_date desc, a_time desc", $MachineNum);
$rs = mssql_query($SQL, $link) or trigger_error(sprintf('Query failed: %s', mysql_error()), E_USER_ERROR);
if(($rs = TRUE)) {
trigger_error (sprintf("No data exists for machine %s", $MachineNum),E_USER_ERROR);
die;
}
No matter what is entered I always get "No data exists......."
Please tell me what I am misunderstanding.
--
Regards,
Alf Stockton www.stockton.co.za
Q: Why was Stonehenge abandoned?
A: It wasn't IBM compatible.
My email disclaimer is available at www.stockton.co.za/disclaimer.html