checking if a MySQL record exists
Posted: Thu Aug 08, 2002 3:29 pm
how can you check if a record exists, just post the query and it will be greatly appreciated
A community of PHP developers offering assistance, advice, discussion, and friendship.
http://forums.devnetwork.net/
Code: Select all
$result = mysql_query("SELECT * FROM tablename WHERE <conditions>");
$num_results = mysql_num_rows($result);
if( $num_results == 0 )
echo "No results found";
else
echo "Results found";