ID:               15417
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Feedback
+Status:           Open
 Bug Type:         MySQL related
 Operating System: Debian Linux 2.4.10
 PHP Version:      4.1.1
 New Comment:

In fact I got many 'Got an error reading communication
 packets' errors on MySQL Server (like 5 errs / hour). I thought that,
but shouldn't it give an error on mysql_query? Does mysql_num_rows
requires connection to MySQL server or does it use recordset in memory?


Previous Comments:
------------------------------------------------------------------------

[2002-02-07 11:19:22] [EMAIL PROTECTED]

My hitch is that you're running out of mysql connections for some
reason... add this and check it:
mysql_connect() or die ("error");

of course use the normal mysql_connect function (with all parameters).

Derick

------------------------------------------------------------------------

[2002-02-07 11:07:18] [EMAIL PROTECTED]

I never had problems with semi-colons at the end of queries. But
neverthles I removed semi-colons and tried again. The result was the
same. For 10 execution I got two errors:

[07-Feb-2002 09:52:21] PHP Warning:  34 is not a valid MySQL result
resource in /usr/local/webhosts/www_asenashop.com/test.php on line 37
[07-Feb-2002 09:52:48] PHP Warning:  34 is not a valid MySQL result
resource in /usr/local/webhosts/www_asenashop.com/test.php on line 37

I wonder why the error message contains specific number but not
"supplied argument"?

------------------------------------------------------------------------

[2002-02-07 01:40:57] [EMAIL PROTECTED]

I don't see any real reason for these failures, but I do see spurious
semi-colons in your queries.  You should not be sending a semi-colon to
terminate a query when sending it through mysql_query()

------------------------------------------------------------------------

[2002-02-06 21:04:08] [EMAIL PROTECTED]

We moved our server from FreeBSD/PHP 4.0.6/Apache 1.3.20 to Debian/PHP
4.1.1/Apache 1.3.22. Now we are occasionally receiving the following
warning for mysql_num_rows:

PHP Warning:  6 is not a valid MySQL result resource in
/usr/local/webhosts/default/test.php on line 40

sometimes number 6 changes to 25, 38 etc. I could not figure out under
which conditions it happens as most of the time when page is refreshed
it disappears. It happens on many pages and probability of having
warning increases as number of queries in the page increases. When that
warning received there are no other errors or warnings. Also there is
no result assosciated for the recordset that mysql_num_rows using
although there should be and other recordsets are working fine.

I tried to reproduce the error with the following script and I managed
to get a bunch of them. Approximately I got 9 warnings for 100
execution of the script. All executions are identical and warnings
seemed to happen randomly.

Here is the script that I used for testing. The query returns 3 rows
normally:


<?
$dbHost = "192.168.10.12";
$dbUser = "phpuser";
$dbPass = "passwd";
$dbName = "sb";

//Server Connection
if(!($dbLink = mysql_pconnect($dbHost,$dbUser,$dbPass)))
{
print("Failed to connect to database!<BR>\n");
exit();
}

//select database
if(!mysql_select_db($dbName,$dbLink))
{
print("Can't use database!<BR>\n");
exit();
}
for($i=0;$i<20;$i++)
{
        $qryCompare = "SELECT * FROM sb_Compare WHERE constant = 11 AND
variant = 10;";
        if(!($recCompare=mysql_query($qryCompare, $dbLink)))
        {
          print("Query error!...<BR>\n");
          print("MySQL say : " . mysql_error() . "<BR>\n");
          print("Query was : $qryCompare<BR>\n");
          exit();
        }

        $qryCompar = "SELECT * FROM sb_Compare WHERE constant = 11 AND variant
= 10;";
        if(!($recCompar=mysql_query($qryCompar, $dbLink)))
        {
          print("Query error!...<BR>\n");
          print("MySQL say : " . mysql_error() . "<BR>\n");
          print("Query was : $qryCompar<BR>\n");
          exit();
        }

        echo mysql_num_rows($recCompare);
        echo mysql_num_rows($recCompar);
}
?>


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=15417&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to