Error is:
Warning: Invalid argument supplied for foreach() in D:\wamp\www\greenmusic\admin\sec.php on line 269.

Code is:

<?php if(isset($_REQUEST['action'])) 
              {
              	echo $values=$_REQUEST['check'];
              	foreach($values as $id)
              	{
              		$mdelete="DELETE FROM songs WHERE id='".$id."'";
              		mysql_query($mdelete);
              	}
              } ?>

Can anyone help me. I'll be thankful to you.

Recommended Answers

All 3 Replies

foreach takes array as an argument.
$values must be an array.echo $value and you will know that.
html field name should be 'check[]' will make $values an array.

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.