Page 1 of 1

checking if a MySQL record exists

Posted: Thu Aug 08, 2002 3:29 pm
by pb2ya
how can you check if a record exists, just post the query and it will be greatly appreciated

Posted: Thu Aug 08, 2002 4:37 pm
by RandomEngy

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";

ok thx

Posted: Thu Aug 08, 2002 5:56 pm
by pb2ya
thanx a lot. sry for askin yall all these questions, when i finish my script, ill give it 2 yall.