Re: MySQL resource

From: Date: Mon, 15 Oct 2001 08:48:06 +0000
Subject: Re: MySQL resource
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-71084@lists.php.net to get a copy of this message
mysql_query returns an integer resource ID >0 so I think #2 is good as #1....if var_dump returns "int(1)" instead of "resource id...." you have a problem somewhere in your code. -- Andrey Hristov Web Developer IcyGEN Corporation BALANCED SOLUTIONS http://www.icygen.com On Monday 15 October 2001 11:52, you wrote: > 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

« previous php.general (#71084) next »