mysql_list_dbs() bug? Or maybe mysql_connect() bug?
| From: | Keith Devens | Date: | Sat, 09 Sep 2000 22:10:25 +0000 |
| Subject: | mysql_list_dbs() bug? Or maybe mysql_connect() bug? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-16011@lists.php.net to get a copy of this message | ||
Here's my code
<?php
function result_printer($result_id){
$i = 0;
while ($i < mysql_num_rows ($result_id)) { //Line 15
$tb_names[$i] = mysql_tablename ($result_id, $i);
echo $tb_names[$i] . "<BR>";
$i++;
}
}
//--------------------------------------
if($conn = mysql_connect ()){ //Line 23
echo "Successful!!";
}
else{
echo "Unsuccessful!!";
}
if(mysql_close()){
echo "<p>Successfully closed the connection</p>";
}
echo "<p>Tables in mysql are:<br>";
$result_id = mysql_list_tables ("mysql");
result_printer($result_id);
echo "<p>Databases on localhost are:<br>";
$result_id = mysql_list_dbs (); //Line 39
result_printer($result_id);
?>
Check out Line 23. If I assign the result of mysql_connect() to somewhere
like I'm doing, the code works fine, but if I don't assign it anywhere (and
just take out "$conn = ") it gives me this error when it hits
mysql_list_dbs():
Warning: 1 is not a valid MySQL-Link resource in *myfilename* on line 39
Warning: Supplied argument is not a valid MySQL result resource in
*myfilename* on line 15
This behavior seems odd. It seems like it could be a bug somewhere. I'm
using version 4.0.2 on Windows.
Anyone have any word on this?
Keith