PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #6693

Trouble with mysql_free_result -> "not a valid MySQL result resource"

Details

Submitted2006-02-04 17:38 UTC
Frommikko dot pori at ncc dot fi
StatusWont fix
PackageDB
PHP Version5.1.2
OSLinux
Roadmaps(Not assigned)

Comments

[2006-02-04 17:38 UTC] mikko dot pori at ncc dot fi

Description:
------------
Making the following qeury:

$tulos2=$db->getOne("SELECT tila_id FROM Lomake_tila WHERE tila_id='$rivi[id]' AND lomake_id='$lomake'"); (kohde.php, line 99)

causes the following error to appear when there is no result from the qeury(0 lines). When the query has something to bring back, all works normally.

Also, changing the connectiontype to autofree=>false instead of true makes the error disappear:

$options = array('debug'=>2,'autofree'=>false);

Expected result:
----------------
No errors ;)

When you have no results, thats what you should get.

Actual result:
--------------
PHP Error [2] [mysql_free_result(): supplied argument is not a valid MySQL result resource] at line 422 in /usr/share/php/DB/mysql.php. (mysql.php:422),(DB.php:1285),(common.php:1243),(kohde.php:99)

[2006-04-20 17:50 UTC] sn_ at gmx dot net

I'm not a developer of DB but i tried to reproduce the bug. I was not able to reproduce it with any error reporting levels and so on. On my DB 1.7.6 installed by using pear install, DB prevent error output by adding @ befor mysql_free.

So line 422 looks like:
function freeResult ($result)
{
return @mysql_free_result($result);
}

So there should be no error. Well i didn't get an error.