Testing a SQL Query for True or False
- by KickingLettuce
$sql = "SELECT # FROM users WHERE onduty = 1 AND loc_id = '{$site}';";
$result = mysql_query($sql);
I simply want to test if this is true or false. If it returns 0 rows, I want next line to be something like:
if (!$result) { //do this; }
However, in my test, I am getting false when I know it should be true. Is this sound logic here?
(note, yes I know I should be using mysqli_query, that is not what I am asking here)