this is my code
function code_exists($code){
$code = mysql_real_escape_string($code);
$code_exists = mysql_query("SELECT COUNT('url_id') FROM 'links' WHERE 'code'='$code'");
return (mysql_result($code_exists, 0) == 1) ? true : false;
}
it is supposed to check the db to make sure the $code is in it or not
but it keeps giving me the same error
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in
/home/codyl/public_html/projects/tests/url/func.inc.php on line 16
As being said by Shakti you have an error in your sql
You need to surround field name with ticks (`) not single quotes. You should also add a statement to chech if the query was run as expected.
This will kill your program throwing the mysql error.