I'm getting
PHP Notice: Undefined variable: db_list in C:\mypage.php on line xx
when I use the following code:
<?php
$conn = @mysql_connect( "localhost", "myname", "mypassword" )
or die( "Sorry - could not connect to MySQL" );
$rs= @mysql_list_dbs( $conn )
or die( "Sorry - could not list databases" );
for( $row=0; $row < mysql_num_rows($rs); $row++ )
{
$db_list .= mysql_tablename( $rs, $row ) . "<br>";
}
?>
This is copied straight out of a book I'm using to try to learn
about PHP and MySQL. Can someone tell me what's causing the
Undefined variable error? I didn't know that variables had to be
defined.
Using: PHP 5.0.1 MySQL 4.1.9