Possible Duplicate:
mysql_fetch_array() expects parameter 1 to be resource, boolean given in select
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in
Please help I have set up a database in MYSQL and want my program to print data from the database. I have a slight issue a warning comes up saying: "Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in" Can any one help please
'
//open a MySQL Connection
$link = mysql_connect('localhost', 'root', '');
if(!$link)
{
die('Connection failed:' .mysql_error());
}
//select the database to work with
$db = mysql_select_db('test (2)');
if ($db)
{
die('Selected database unavailable:' .mysql_error());
}
//create and excute a mysql query
$sql = "SELECT artist_name FROM artist";
$result = mysql_query($sql);
//loop through the returned data and output it
while($row = mysql_fetch_array($result))
{
printf("Artist: %s<br/>", $row['artist_name']);
}
// free memory associated with the query
mysql_free_result($result);
//close the connection
mysql_close($link);
'