I am a semi-newbie to PHP and MySQL.
I need to search a table to see if a certain record exists. I do not need to know the data in the record. I am trying to figure out if I need to collect the data to insert into the table. After researching this I concluded the best approach is to use the code show below. Problem seems to be when no records exist I get the warning shown below.
Am I using the best method to figure out whether a record exists?
If not, what is a better method?
How do I fix the warning message? I need to see the actual PHP code that will work.
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource
$result=mysql_query("SELECT COUNT(*) FROM tableA WHERE (column1 = $num) AND (column2 = $uid)");
$count = mysql_fetch_row($result);
echo "Num of rows = $count";