$result = mysql_query("SELECT FROM table WHERE job_id = '$key'") or die("Error: ". mysql_error(). " with query ". $query);
$num_rows = mysql_num_rows($result);
if($num_rows > 0) {
mysql_query("UPDATE table SET row = '$value' WHERE job_id = '$key'");
}else{
mysql_query("INSERT INTO table SET row = '$value', job_id = '$key'");
}
I need to check if the database has an existing record, if it doesn't I want to create one. Every time I run this though I get:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in my/web/directory/index.php on line 147
I've looked through existing posts on this website, but most of them involve the user having something wrong with his syntax. Such as forgetting mysql_query(); as far as I can tell I think I have the syntax right, but I'm still getting an error. Any help?