Unix Technical Forum

SEO

vBulletin Search Engine Optimization


Go Back   Unix Technical Forum > Database Server Software > MySQL

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-07-2008, 10:16 AM
Caffeneide
 
Posts: n/a
Default php 5 and mysql failure

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 bfore.
My question is, is there any kind of limit somewhere in php5 or in
mysql?
Thanks for help

Laura
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-07-2008, 10:16 AM
Rik Wasmus
 
Posts: n/a
Default Re: php 5 and mysql failure

On Mon, 05 May 2008 09:50:10 +0200, Caffeneide <mooomo@gmail.com> 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 ...


$result = mysql_query(....);
if(!$result) echo mysql_error(); will tell you what is wrong.

> 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!


Usually that means something that you can't see in HTML, look at the
_source_ of the created page for the correct query.

> 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 bfore.
> My question is, is there any kind of limit somewhere in php5 or in
> mysql?


Yes, lots & lots of different limits, consult their manuals.
--
Rik Wasmus
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-07-2008, 10:16 AM
Rik Wasmus
 
Posts: n/a
Default Re: php 5 and mysql failure

On Mon, 05 May 2008 09:56:39 +0200, Rik Wasmus
<luiheidsgoeroe@hotmail.com> wrote:

> On Mon, 05 May 2008 09:50:10 +0200, Caffeneide <mooomo@gmail.com> 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 ...

>
> $result = mysql_query(....);
> if(!$result) echo mysql_error(); will tell you what is wrong.
>


From comp.lang.php:
> This is the error logged: 2006: MySQL
> server has gone away


http://dev.mysql.com/doc/refman/5.0/en/gone-away.html

Most likely, set max_allowed_packet higher.
--
Rik Wasmus
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-07-2008, 10:16 AM
Caffeneide
 
Posts: n/a
Default Re: php 5 and mysql failure

On 6 Mag, 09:00, "Rik Wasmus" <luiheidsgoe...@hotmail.com> wrote:
> On Mon, 05 May 2008 09:56:39 +0200, Rik Wasmus
>
> <luiheidsgoe...@hotmail.com> wrote:
> > On Mon, 05 May 2008 09:50:10 +0200, Caffeneide <moo...@gmail.com> 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 ...

>
> > $result = mysql_query(....);
> > if(!$result) echo mysql_error(); will tell you what is wrong.

>
> From comp.lang.php:
>
> > This is the error logged: 2006: MySQL
> > server has gone away

>
> http://dev.mysql.com/doc/refman/5.0/en/gone-away.html
>
> Most likely, set max_allowed_packet higher.
> --
> Rik Wasmus


It seems I resolved the problem setting "wait_timeout" higher...it's
ok?? thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:27 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62