it works but i don't uderstand
| From: | Bas Jobsen | Date: | Wed, 24 Oct 2001 15:33:54 +0000 |
| Subject: | it works but i don't uderstand | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-13672@lists.php.net to get a copy of this message | ||
Hello,
I'm building some database class, so i can reuse my code when using a not
mysql database system.
I'm implementing a free_result now;
some code of my class
class database
{
........
function free_result($result)
{
mysql_free_result($result);
return;
}
..............
}
?>
some of the code:
include ("class_mysql.php");
$db= new database();
$db->connect();
$result=$db->select_query("SELECT * FROM users");
echo mysql_num_rows($result);
$db->free_result($result);
echo mysql_num_rows($result);
Running this will give:
2 and "Warning: 2 is not a valid MySQL result resource"
So this seems to work, but why? Why is $result handled as it is a global
var?
I should think it must be something like:
function free_result(&$result)
{
mysql_free_result($result);
return;
}
But this don't work.
Thanks,
Bas