0

It is showing error about foreach loop. Error is:


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

<form id="adminsform" name="adminsform" method="post" action="">
<input type="checkbox" name="master" onClick="checkedAll('adminsform')" value=""/>
<?php while($row=mysql_fetch_array($result))
                  {  ?>
                  
                    <input type="checkbox" name="musicid[]" value="<?=$row['id']?>" />

                    <?=$row['song']?>

                    <?=$row['singername']?>

                   <?=$row['songtype']?>
                    
                    <td width="15%"><?=$row['songtypeav']?></td>
                    <?php if($row['songtypeav']=="Audio Song") { ?>
                    <a href="sec.php?id=<?=$row['id']?>&act=play">Play</a><?=" "?><a href="edit.php?id=<?=$row['id']?>">Edit</a>
                    <?php } if($row['songtypeav']=="Video Song") { ?>
                     <a href="vidsong.php?id=<?=$row['id']?>">Play</a><?=" "?><a href="edit.php?id=<?=$row['id']?>">Edit</a>
                    <?php } ?>
                  
if(isset($_REQUEST['ac'])){


   foreach($_REQUEST['musicid'] as $ids) 
 {
 	$mdquery="DELETE FROM members WHERE id='$ids'";
 	mysql_query($mdquery);
 	
 	
 	//header('Location:sec.php');
 }

 }
</form>
3
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by pzuurveen
0

what are u try to do with

<?=$row['song']?>

if u wan to display $row

<? echo $row['song']; ?>

your code will look like

<form id="adminsform" name="adminsform" method="post" action="">
<input type="checkbox" name="master" onClick="checkedAll('adminsform')" value=""/>
<?php 
while($row=mysql_fetch_array($result))
	{  ?>
   <input type="checkbox" name="musicid[]" value="<?php echo $row['id']; ?>" />
   <?php echo $row['song']." ".$row['singername']." ".$row['songtype']; ?>
 
   <td width="15%"><?=$row['songtypeav']; ?></td>
   <?php 
   if($row['songtypeav']=="Audio Song") 
   			{ ?>
            <a href="sec.php?id=<?php echo $row['id']; ?>&act=play">Play</a>
            &nbsp
            <a href="edit.php?id=<?php echo $row['id']; ?>">Edit</a>
      <?php } 
   if($row['songtypeav']=="Video Song") 
   			{ ?>
           <a href="vidsong.php?id=<?php echo $row['id']; ?>">Play</a>
           &nbsp
           <a href="edit.php?id=<?php echo $row['id']; ?>">Edit</a>
      <?php } 
	                
   if(isset($_REQUEST['ac']))
		{
   		foreach($_REQUEST['musicid'] as $ids) 
 			{
 			$mdquery="DELETE FROM members WHERE id='$ids'";
 			mysql_query($mdquery);
 			//header('Location:sec.php');
 			}
 		}
	}?>
</form>
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.