-2
<?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)){

Edited by davy_yg: n/a

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by pritaeas
0

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 !
}

Edited by divyakrishnan: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.