Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\wamp\www\firewall\php\allresults.php on line 3

The annoying thing is, I have used this multiple times on different applications, I dont know why it think the result is boolean?
the exact same code works on a different database, I just cant see why it wont work here?

Many Thanks

<?php
$result = mysql_query("SELECT * FROM device");
while($row = mysql_fetch_array($result)){
$id = $row['id'];
$name= $row['name'];
$access = $row['access'];
$type= $row['type'];
$customer= $row['customer'];
$make = $row['make'];
$model = $row['model'];
$serial = $row['serial'];
$os  =$row['os'];
$software = $row['software'];
$smartcenter = $row['smartcenter'];
echo $id ."<br />". $name;
}
?>

Where is your mysql_connect()?

there is an include statement (I didnt post it) it does work as I dont get the "cannot connect" error

What does mysql_error() return?

it was returning "no database selected" which is very strange as I include the connection parameters, Its all fixed now - I included the connection file within the same page as the query page. sorry for wasting your time, thanks for replying though.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.