mysql05 Jul 2008 08:40 pm
Checking for failed database search
One way of detecting of a select statement returned any results. Using this currently…
$result = mysql_query(“SELECT * FROM some_table where some_field = ’some_value’ “, $connection);
if (!$result)
$count=0;
else
$count =mysql_num_rows($result);
if ($count == 0) {
die(“Database query failed: ” . mysql_error());
