note 49375 added to function.mysql-query
| From: | jon at websandbox dot net | Date: | Wed, 26 Jan 2005 01:25:52 +0000 |
| Subject: | note 49375 added to function.mysql-query | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-83948@lists.php.net to get a copy of this message | ||
I think it's important to note (for newbies, like me especially) that an empty result is not
the same as an error:
<?php
/* 'bar' is an empty table in the db */
$rs = mysql_query("SELECT
foo FROM bar")
if($rs) {
echo mysql_num_rows($rs); //outputs: 0
}
/* malformed query /*
$rs = mysql_query("SELECT foo FRO bar");
if($rs) {
echo "This will never be echoed";
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.mysql-query.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49375
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49375&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49375&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49375&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49375&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49375&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49375&report=yes
Search -- http://master.php.net/manage/user-notes.php