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

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()


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

[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