Jump to content

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


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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.