Re: MySQL resource
| From: | Toke Herkild | Date: | Mon, 15 Oct 2001 08:52:01 +0000 |
| Subject: | Re: MySQL resource | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-71083@lists.php.net to get a copy of this message | ||
Toke Herkild:
If:
mysql_query($Result) returns either '1' or 'Resource #ID?' and as far as
I've found oout if it does not find data at all it returns '2' then the
correct if clause would be :
if ((mysql_query()>0) and (mysql_query() != 2)){ do stuff }
correct my if I'm wrong...
David Otton :
It appears that it can be an int in some situations. I guess I'd have
to check source code to be certain, but...
if I do this :
echo(mysql_query("SELECT ...."));
I get 'Resource id#4' echoed, while if I do this :
echo(mysql_query("INSERT ...."));
I get a straight '1'.
The '1' is returned when you do an UPDATE/INSERT/DELETE, and the
'Resource id' when you do a select. It's a nasty one, but it is
documented (kinda) in the manual pages for mysql_affected_rows(). So