What's wrong with my PHP/MySQL?

Nathan

New member
Here is the error:

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in /hermes/bosweb/web161/b1610/ipg.teklyscom/news/resources/func/blog.php on line 82

And on blog.php I have:

function category_exists($field, $value) {
$field = mysql_real_escape_string($field);
$value = mysql_real_escape_string($value);
$query = mysql_query("SELECT COUNT(1) FROM categories WHERE {$field} = {$value}");

return (mysql_result($query, 0) == '0' ) ? false : true; #line 82
}

What am I doing wrong?
 
Back
Top