<?php
		//LOAD USER
	$result = mysql_query("SELECT * FROM event");
		while ($data = mysql_fetch_array($result)){
	?>
		<tr>
	<td><?php echo $data['event'];?></td>
	<td><?php echo $data['tempat'];?></td>
	<td><?php echo readDate($data['mulai']);?></td>
	<td><?php echo readDate($data['selesai']);?></td>
				<td>
	<a href="./event_manager.php?id=<?php echo $data['id']; ?>&mode=delete">Hapus</a> | 
	<a href="./event_manager.php?id=<?php echo $data['id']; ?>&mode=edit">Edit</a>
			</td>
		</tr>
	<?php
	}
	?>
	</table>

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\php_template2\event_manager.php on line 207


Line 207:

while ($data = mysql_fetch_array($result)){

Recommended Answers

All 2 Replies

There is an error in your query .
So the mysql_query function returns a boolean, and not a resource.
mysql_fetch_array() cannot works with a boolean value.
You can check the error in mysql query by using following code

$result = mysql_query("SELECT * FROM event");
if ($result != false) {
    // use $result
} else {
    // an error has occured
    echo mysql_error();
    die;    // note : echoing the error message and dying 
            // is OK while developping, but not in production !
}
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.