Hello All -
I'm trying to display an error notification if a SELECT query contains the wrong information in a WHERE clause.
For example:
$row = 1;
$sql =
"SELECT *
FROM tbl_attack_log
WHERE fld_row_id = '" . $row . "'";
Now, fld_row_id = 1 doesn't exist in this db, but a resource is still returned. I thought that mysql would throw an error (like it does if the table name was wrong, etc) under this circumstance, but it doesn't.
I've thought about using mysql_num_rows, but there are times where zero rows exist in this table which is fine.
Does mysql generate any kind of error like "row number specified doesn't exist"? If not, is there a way to evaluate the resource in php to trap for this kind of error?