Re: Simple Question
| From: | Matt Schroebel | Date: | Wed, 25 Oct 2000 20:08:07 +0000 |
| Subject: | Re: Simple Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-21917@lists.php.net to get a copy of this message | ||
To suppress errors prepend an @ sign in from of the mysql command
i.e.
$result = @mysql_query($sql,$db);
$result will only be 0 (false) if you have a syntax error in the sql statement. So if you want to
see if you have any matches, use
$currentMatches = mysql_num_rows($result);
>>> "Chris" <php_list@ibcnetwork.net> 10/23 12:41 PM >>>
Hi,
I looked in the manual but can't find anything to help.
How do I repress mysql errors from displaying?
Ex:
$strsql = "SELECT myval FROM table where date = '$strdte'";
$result = mysql_db_query("db",$strsql);
How can I see if $result is valid?
When I do echo $result, it allways prints the number 2, whether is finds data or not. If not it give
me the error that mysql can jumpt to row 0 on the next statement which is:
$strmydte = mysql_result($result,"myval");
I need to see if there is a result before I reach the above line so I can prevent the error display
and do something else.
Thanks,
Chris