Page 1 of 1

mysql_num_rows & '@'

Posted: Tue Aug 19, 2003 1:50 am
by nigma
Can anyone tell me what the difference between refering to calling a function but placing a @ symbol before it and calling it normally without @ symbol?

Example #1:

Code: Select all

$rowsReturned = @mysql_num_rows($result);
Example #2:

Code: Select all

$rowsReturned = mysql_num_rows($result);
Thanks for any help provided.

Posted: Tue Aug 19, 2003 3:01 am
by JayBird
The @ is used to suppress errors. mysql_num_rows() always returns true unless the result you're pointing at hasn't returned correctly - e.g. the query has failed. If you expect that to happen, you should probably terminate output before you call mysql_num_rows(): e.g.

Code: Select all

if(!($check_Subjectquery = mysql_db_query($db2,$checkSubject)))
{
 echo "Query failed: " . mysql_error();
 exit;
}
Mark

Posted: Tue Aug 19, 2003 4:42 am
by twigletmac
Although don't use mysql_db_query() 'cause it be deprecated.

Mac