Jump to content

mysql_fetch_array() expects parameter 1 to be resource, boolean error?


ultraloveninja

Recommended Posts

This is a new error for me.  I tried looking through some older posts and so far nothing had fixed it and thus I am stumped.

 

Any idea what could be throwing this error?

 


<table>
  <?php
//open DB connection
include 'dbconn.php';
$sql = "select * tbl_test";	
$result = mysql_query($sql,$conn);

print $sql;

while ($row = mysql_fetch_array($result)){
$status = $row['status'];
$space = $row['spacename'];

if ($status=="reserved") {

echo <<<END
<tr>
<td style="background-color:#F00; color:#FFF;" align="center">Reserved</td>
</tr>
END;

    } else {

echo <<<END		
<tr>
<td align="center">$space</td>
</tr>
END;

}
}
?>
</table>

 

the error is telling you that your query is wrong and didn't produce a valid result, hence mysql_fetch_array() failed too.

 

$sql = "select * tbl_test";

 

and here the same topic was discussed today.. the suggestions there could help you to include improvements in your code

http://www.phpfreaks.com/forums/index.php?topic=331080.0

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.