Okay, start over here. What I want to do is query the database to see if the id exists. If it doesn't then I want to add a row. If it does, then I want to skip that part. The trouble I'm having is that if the row is not out there, then I get an error message on my query. I have tried numerous combinations, but haven't been able to find what works. Current code:
$sql = "SELECT COUNT(*) FROM speaker WHERE sid = '".$_POST['sid']."' LIMIT 1";
$result = mysql_query($sql,$dblink) || die("QUERY FAILED: $sql");
$numrows = 0;
if (mysql_num_rows($result)) { $numrows++; }
echo "numrows:".$numrows."<br>sql: ".$sql."<br>";
I get this error:
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /web/apache/htdocs/x/x/input.php on line 24
numrows:0
sql: SELECT COUNT(*) FROM speaker WHERE id='123456' LIMIT 1
Line 24 is the if statement. I've tried a check $result, but on that, I get a return of 1, regardless of whether there's a match or not.
Please, any ideas, I'm quickly running out of time. I have a 5/1 deadline for customer delivery.