Connecting Tech Pros Worldwide Forums | Help | Site Map

php 5 and mysql failure

Caffeneide
Guest
 
Posts: n/a
#1: Jun 2 '08
I'm using a php script which performs three xml queries to other three
servers to retrieve a set of ids and after I do a query to mysql of
the kind
SELECT * FROM table WHERE id IN ('set of ids');
Although I'm sure the connection to the database is ok, I sometimes
get an error of this kind:
*Warning*: mysql_fetch_object(): supplied argument is not a valid
MySQL result resource in ...
This does not happen every time i run the script, only sometimes.
If I echo the query, copy and paste in phpmyadmin, or if I perform the
same query in a script that does only the query without the rest it
works!
After troubleshooting this issue I noticed that it usually failed when
I had a big set of ids (positive response from more than one server).
This means that the script used a bigger amount of memory and probably
more resources, but I did not get an "out of memory error", I got the
one described before.
My question is, is there any kind of limit somewhere in php5 or in
mysql (version 5)?
Thanks for help,

YEHUDI GARRETT

Luuk
Guest
 
Posts: n/a
#2: Jun 2 '08

re: php 5 and mysql failure


Caffeneide schreef:
Quote:
I'm using a php script which performs three xml queries to other three
servers to retrieve a set of ids and after I do a query to mysql of
the kind
SELECT * FROM table WHERE id IN ('set of ids');
Although I'm sure the connection to the database is ok, I sometimes
get an error of this kind:
*Warning*: mysql_fetch_object(): supplied argument is not a valid
MySQL result resource in ...
This does not happen every time i run the script, only sometimes.
If I echo the query, copy and paste in phpmyadmin, or if I perform the
same query in a script that does only the query without the rest it
works!
After troubleshooting this issue I noticed that it usually failed when
I had a big set of ids (positive response from more than one server).
This means that the script used a bigger amount of memory and probably
more resources, but I did not get an "out of memory error", I got the
one described before.
My question is, is there any kind of limit somewhere in php5 or in
mysql (version 5)?
Thanks for help,
>
YEHUDI GARRETT
yes, there is..
http://tinyurl.com/3jgwjn

but, how many (or how much?) id's do get returned at max?
maybe you have to rewrite your solution to get a working one..

--
Luuk
Jerry Stuckle
Guest
 
Posts: n/a
#3: Jun 2 '08

re: php 5 and mysql failure


Caffeneide wrote:
Quote:
I'm using a php script which performs three xml queries to other three
servers to retrieve a set of ids and after I do a query to mysql of
the kind
SELECT * FROM table WHERE id IN ('set of ids');
Although I'm sure the connection to the database is ok, I sometimes
get an error of this kind:
*Warning*: mysql_fetch_object(): supplied argument is not a valid
MySQL result resource in ...
This does not happen every time i run the script, only sometimes.
If I echo the query, copy and paste in phpmyadmin, or if I perform the
same query in a script that does only the query without the rest it
works!
After troubleshooting this issue I noticed that it usually failed when
I had a big set of ids (positive response from more than one server).
This means that the script used a bigger amount of memory and probably
more resources, but I did not get an "out of memory error", I got the
one described before.
My question is, is there any kind of limit somewhere in php5 or in
mysql (version 5)?
Thanks for help,
>
YEHUDI GARRETT
>
It's possible you're running into a limit, but it's quite large.

The "supplied argument is not a valid MySQL result resource" indicates
your mysql_query() returned false, probably. You should ALWAYS check
the result of mysql_query(), and if it fails, log the error (you really
don't want to display those errors to your users, do you?). Or, on a
development system, display the error.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Caffeneide
Guest
 
Posts: n/a
#4: Jun 2 '08

re: php 5 and mysql failure


On Apr 30, 5:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
Caffeneide wrote:
Quote:
I'm using a php script which performs three xml queries to other three
servers to retrieve a set of ids and after I do a query to mysql of
the kind
SELECT * FROM table WHERE id IN ('set of ids');
Although I'm sure the connection to the database is ok, I sometimes
get an error of this kind:
*Warning*: mysql_fetch_object(): supplied argument is not a valid
MySQL result resource in ...
This does not happen every time i run the script, only sometimes.
If I echo the query, copy and paste in phpmyadmin, or if I perform the
same query in a script that does only the query without the rest it
works!
After troubleshooting this issue I noticed that it usually failed when
I had a big set of ids (positive response from more than one server).
This means that the script used a bigger amount of memory and probably
more resources, but I did not get an "out of memory error", I got the
one described before.
My question is, is there any kind of limit somewhere in php5 or in
mysql (version 5)?
Thanks for help,
>
Quote:
YEHUDI GARRETT
>
It's possible you're running into a limit, but it's quite large.
>
The "supplied argument is not a valid MySQL result resource" indicates
your mysql_query() returned false, probably. You should ALWAYS check
the result of mysql_query(), and if it fails, log the error (you really
don't want to display those errors to your users, do you?). Or, on a
development system, display the error.
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
thanks. the query is correct because only sometimes I got this
error...but the way on which I got this error seems to be completely
random...the number of ids I returned is quite variable but it's
around some (one-two-three) hundreds
Caffeneide
Guest
 
Posts: n/a
#5: Jun 2 '08

re: php 5 and mysql failure


On Apr 30, 5:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
Caffeneide wrote:
Quote:
I'm using a php script which performs three xml queries to other three
servers to retrieve a set of ids and after I do a query to mysql of
the kind
SELECT * FROM table WHERE id IN ('set of ids');
Although I'm sure the connection to the database is ok, I sometimes
get an error of this kind:
*Warning*: mysql_fetch_object(): supplied argument is not a valid
MySQL result resource in ...
This does not happen every time i run the script, only sometimes.
If I echo the query, copy and paste in phpmyadmin, or if I perform the
same query in a script that does only the query without the rest it
works!
After troubleshooting this issue I noticed that it usually failed when
I had a big set of ids (positive response from more than one server).
This means that the script used a bigger amount of memory and probably
more resources, but I did not get an "out of memory error", I got the
one described before.
My question is, is there any kind of limit somewhere in php5 or in
mysql (version 5)?
Thanks for help,
>
Quote:
YEHUDI GARRETT
>
It's possible you're running into a limit, but it's quite large.
>
The "supplied argument is not a valid MySQL result resource" indicates
your mysql_query() returned false, probably. You should ALWAYS check
the result of mysql_query(), and if it fails, log the error (you really
don't want to display those errors to your users, do you?). Or, on a
development system, display the error.
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Probably it's a problem related to php and mysql. if I copy and paste
the query in phpmyadmin it always works, so I wouldn't say it's a
mysql limit problem.
Rik Wasmus
Guest
 
Posts: n/a
#6: Jun 2 '08

re: php 5 and mysql failure


On Mon, 05 May 2008 09:32:02 +0200, Caffeneide <mooomo@gmail.comwrote:
Quote:
On Apr 30, 5:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
>Caffeneide wrote:
Quote:
I'm using a php script which performs three xml queries to other three
servers to retrieve a set of ids and after I do a query to mysql of
the kind
SELECT * FROM table WHERE id IN ('set of ids');
Although I'm sure the connection to the database is ok, I sometimes
get an error of this kind:
*Warning*: mysql_fetch_object(): supplied argument is not a valid
MySQL result resource in ...
This does not happen every time i run the script, only sometimes.
If I echo the query, copy and paste in phpmyadmin, or if I perform the
same query in a script that does only the query without the rest it
works!
After troubleshooting this issue I noticed that it usually failed when
I had a big set of ids (positive response from more than one server).
This means that the script used a bigger amount of memory and probably
more resources, but I did not get an "out of memory error", I got the
one described before.
My question is, is there any kind of limit somewhere in php5 or in
mysql (version 5)?
Thanks for help,
>>
Quote:
YEHUDI GARRETT
>>
>It's possible you're running into a limit, but it's quite large.
>>
>The "supplied argument is not a valid MySQL result resource" indicates
>your mysql_query() returned false, probably. You should ALWAYS check
>the result of mysql_query(), and if it fails, log the error (you really
>don't want to display those errors to your users, do you?). Or, on a
>development system, display the error.
>>
>
thanks. the query is correct because only sometimes I got this
error...
I'd say: the (building of the) query is incorrect because sometimes you
get an error. How are you building it?
Quote:
but the way on which I got this error seems to be completely
random...the number of ids I returned is quite variable but it's
around some (one-two-three) hundreds
In the small hundreds should be a piece of cake for any database, so
that's probably not an issue. (Well, at least not on the MySQL side of
things).

And last but not least: when echoing out a query to check it's results
another way (phpMyAdmin, command line) always copy the _source_, and never
just what's in a browser window.
--
Rik Wasmus
Jerry Stuckle
Guest
 
Posts: n/a
#7: Jun 2 '08

re: php 5 and mysql failure


Caffeneide wrote:
Quote:
On Apr 30, 5:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
>Caffeneide wrote:
Quote:
>>I'm using a php script which performs three xml queries to other three
>>servers to retrieve a set of ids and after I do a query to mysql of
>>the kind
>>SELECT * FROM table WHERE id IN ('set of ids');
>>Although I'm sure the connection to the database is ok, I sometimes
>>get an error of this kind:
>>*Warning*: mysql_fetch_object(): supplied argument is not a valid
>>MySQL result resource in ...
>>This does not happen every time i run the script, only sometimes.
>>If I echo the query, copy and paste in phpmyadmin, or if I perform the
>>same query in a script that does only the query without the rest it
>>works!
>>After troubleshooting this issue I noticed that it usually failed when
>>I had a big set of ids (positive response from more than one server).
>>This means that the script used a bigger amount of memory and probably
>>more resources, but I did not get an "out of memory error", I got the
>>one described before.
>>My question is, is there any kind of limit somewhere in php5 or in
>>mysql (version 5)?
>>Thanks for help,
>>YEHUDI GARRETT
>It's possible you're running into a limit, but it's quite large.
>>
>The "supplied argument is not a valid MySQL result resource" indicates
>your mysql_query() returned false, probably. You should ALWAYS check
>the result of mysql_query(), and if it fails, log the error (you really
>don't want to display those errors to your users, do you?). Or, on a
>development system, display the error.
>>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>jstuck...@attglobal.net
>==================
>
Probably it's a problem related to php and mysql. if I copy and paste
the query in phpmyadmin it always works, so I wouldn't say it's a
mysql limit problem.
>
Probably it's a problem in your code. If it were a problem related to
php and mysql, phpmyadmin would fail also - it is also php and mysql.


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Jerry Stuckle
Guest
 
Posts: n/a
#8: Jun 2 '08

re: php 5 and mysql failure


Caffeneide wrote:
Quote:
On Apr 30, 5:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
>Caffeneide wrote:
Quote:
>>I'm using a php script which performs three xml queries to other three
>>servers to retrieve a set of ids and after I do a query to mysql of
>>the kind
>>SELECT * FROM table WHERE id IN ('set of ids');
>>Although I'm sure the connection to the database is ok, I sometimes
>>get an error of this kind:
>>*Warning*: mysql_fetch_object(): supplied argument is not a valid
>>MySQL result resource in ...
>>This does not happen every time i run the script, only sometimes.
>>If I echo the query, copy and paste in phpmyadmin, or if I perform the
>>same query in a script that does only the query without the rest it
>>works!
>>After troubleshooting this issue I noticed that it usually failed when
>>I had a big set of ids (positive response from more than one server).
>>This means that the script used a bigger amount of memory and probably
>>more resources, but I did not get an "out of memory error", I got the
>>one described before.
>>My question is, is there any kind of limit somewhere in php5 or in
>>mysql (version 5)?
>>Thanks for help,
>>YEHUDI GARRETT
>It's possible you're running into a limit, but it's quite large.
>>
>The "supplied argument is not a valid MySQL result resource" indicates
>your mysql_query() returned false, probably. You should ALWAYS check
>the result of mysql_query(), and if it fails, log the error (you really
>don't want to display those errors to your users, do you?). Or, on a
>development system, display the error.
>>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>jstuck...@attglobal.net
>==================
>
thanks. the query is correct because only sometimes I got this
error...but the way on which I got this error seems to be completely
random...the number of ids I returned is quite variable but it's
around some (one-two-three) hundreds
>
If the query were correct, you would not be getting the error you are
getting.

Your error indicates mysql_query() returned false. It did not return
zero entries; that is still a result resource (albeit an empty one).

ALWAYS check the result of mysql_query(). And when it returns false,
try logging the error returned by mysql_error(). It also may help to
log the SELECT statement itself.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Caffeneide
Guest
 
Posts: n/a
#9: Jun 2 '08

re: php 5 and mysql failure


On May 5, 2:13 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
Caffeneide wrote:
Quote:
On Apr 30, 5:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
Caffeneide wrote:
>I'm using a php script which performs three xml queries to other three
>servers to retrieve a set of ids and after I do a query to mysql of
>the kind
>SELECT * FROM table WHERE id IN ('set of ids');
>Although I'm sure the connection to the database is ok, I sometimes
>get an error of this kind:
>*Warning*: mysql_fetch_object(): supplied argument is not a valid
>MySQL result resource in ...
>This does not happen every time i run the script, only sometimes.
>If I echo the query, copy and paste in phpmyadmin, or if I perform the
>same query in a script that does only the query without the rest it
>works!
>After troubleshooting this issue I noticed that it usually failed when
>I had a big set of ids (positive response from more than one server).
>This means that the script used a bigger amount of memory and probably
>more resources, but I did not get an "out of memory error", I got the
>one described before.
>My question is, is there any kind of limit somewhere in php5 or in
>mysql (version 5)?
>Thanks for help,
>YEHUDI GARRETT
It's possible you're running into a limit, but it's quite large.
>
Quote:
Quote:
The "supplied argument is not a valid MySQL result resource" indicates
your mysql_query() returned false, probably. You should ALWAYS check
the result of mysql_query(), and if it fails, log the error (you really
don't want to display those errors to your users, do you?). Or, on a
development system, display the error.
>
Quote:
Quote:
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
>
Quote:
Probably it's a problem related to php and mysql. if I copy and paste
the query in phpmyadmin it always works, so I wouldn't say it's a
mysql limit problem.
>
Probably it's a problem in your code. If it were a problem related to
php and mysql, phpmyadmin would fail also - it is also php and mysql.
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
Thank you Jerry, useful hint. This is the error logged: 2006: MySQL
server has gone away

Where has he gone? What can be the problem?
Jerry Stuckle
Guest
 
Posts: n/a
#10: Jun 2 '08

re: php 5 and mysql failure


Caffeneide wrote:
Quote:
On May 5, 2:13 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
>Caffeneide wrote:
Quote:
>>On Apr 30, 5:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>>>Caffeneide wrote:
>>>>I'm using a php script which performs three xml queries to other three
>>>>servers to retrieve a set of ids and after I do a query to mysql of
>>>>the kind
>>>>SELECT * FROM table WHERE id IN ('set of ids');
>>>>Although I'm sure the connection to the database is ok, I sometimes
>>>>get an error of this kind:
>>>>*Warning*: mysql_fetch_object(): supplied argument is not a valid
>>>>MySQL result resource in ...
>>>>This does not happen every time i run the script, only sometimes.
>>>>If I echo the query, copy and paste in phpmyadmin, or if I perform the
>>>>same query in a script that does only the query without the rest it
>>>>works!
>>>>After troubleshooting this issue I noticed that it usually failed when
>>>>I had a big set of ids (positive response from more than one server).
>>>>This means that the script used a bigger amount of memory and probably
>>>>more resources, but I did not get an "out of memory error", I got the
>>>>one described before.
>>>>My question is, is there any kind of limit somewhere in php5 or in
>>>>mysql (version 5)?
>>>>Thanks for help,
>>>>YEHUDI GARRETT
>>>It's possible you're running into a limit, but it's quite large.
>>>The "supplied argument is not a valid MySQL result resource" indicates
>>>your mysql_query() returned false, probably. You should ALWAYS check
>>>the result of mysql_query(), and if it fails, log the error (you really
>>>don't want to display those errors to your users, do you?). Or, on a
>>>development system, display the error.
>>>--
>>>==================
>>>Remove the "x" from my email address
>>>Jerry Stuckle
>>>JDS Computer Training Corp.
>>>jstuck...@attglobal.net
>>>==================
>>Probably it's a problem related to php and mysql. if I copy and paste
>>the query in phpmyadmin it always works, so I wouldn't say it's a
>>mysql limit problem.
>Probably it's a problem in your code. If it were a problem related to
>php and mysql, phpmyadmin would fail also - it is also php and mysql.
>>
>--
>==================
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>jstuck...@attglobal.net
>==================
>
Thank you Jerry, useful hint. This is the error logged: 2006: MySQL
server has gone away
>
Where has he gone? What can be the problem?
>
OK, now we're making some progress. This is a MySQL failure, not one in
PHP (although your query may still have problems).

You need to follow this up on comp.databases.mysql (where I see you also
started a thread).

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Caffeneide
Guest
 
Posts: n/a
#11: Jun 2 '08

re: php 5 and mysql failure


On 5 Mag, 19:05, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
Caffeneide wrote:
Quote:
On May 5, 2:13 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
Quote:
Caffeneide wrote:
>On Apr 30, 5:38 pm, Jerry Stuckle <jstuck...@attglobal.netwrote:
>>Caffeneide wrote:
>>>I'm using a php script which performs three xml queries to other three
>>>servers to retrieve a set of ids and after I do a query to mysql of
>>>the kind
>>>SELECT * FROM table WHERE id IN ('set of ids');
>>>Although I'm sure the connection to the database is ok, I sometimes
>>>get an error of this kind:
>>>*Warning*: mysql_fetch_object(): supplied argument is not a valid
>>>MySQL result resource in ...
>>>This does not happen every time i run the script, only sometimes.
>>>If I echo the query, copy and paste in phpmyadmin, or if I perform the
>>>same query in a script that does only the query without the rest it
>>>works!
>>>After troubleshooting this issue I noticed that it usually failed when
>>>I had a big set of ids (positive response from more than one server).
>>>This means that the script used a bigger amount of memory and probably
>>>more resources, but I did not get an "out of memory error", I got the
>>>one described before.
>>>My question is, is there any kind of limit somewhere in php5 or in
>>>mysql (version 5)?
>>>Thanks for help,
>>>YEHUDI GARRETT
>>It's possible you're running into a limit, but it's quite large.
>>The "supplied argument is not a valid MySQL result resource" indicates
>>your mysql_query() returned false, probably. You should ALWAYS check
>>the result of mysql_query(), and if it fails, log the error (you really
>>don't want to display those errors to your users, do you?). Or, on a
>>development system, display the error.
>>--
>>==================
>>Remove the "x" from my email address
>>Jerry Stuckle
>>JDS Computer Training Corp.
>>jstuck...@attglobal.net
>>==================
>Probably it's a problem related to php and mysql. if I copy and paste
>the query in phpmyadmin it always works, so I wouldn't say it's a
>mysql limit problem.
Probably it's a problem in your code. If it were a problem related to
php and mysql, phpmyadmin would fail also - it is also php and mysql.
>
Quote:
Quote:
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
>
Quote:
Thank you Jerry, useful hint. This is the error logged: 2006: MySQL
server has gone away
>
Quote:
Where has he gone? What can be the problem?
>
OK, now we're making some progress. This is a MySQL failure, not one in
PHP (although your query may still have problems).
>
You need to follow this up on comp.databases.mysql (where I see you also
started a thread).
>
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attglobal.net
==================
thanks, it's seems I resolved this error increasing the value of MySQL
"wait_timeout" options...thank you!
Closed Thread