Okay, so basically, i want to loop mysql_fetch_array inside a foreach loop, like this:
foreach($groupname as $group)
{
$sql2=mysql_query("SELECT * FROM groups WHERE group='$group'");
$row2=mysql_fetch_array($sql2);
?>
<img src="images/groups/" width="100px" height="100px" /><br />
<table>
<tr><td><b>Group: </b></td><td><?php echo $group; ?></td></tr>
<tr><td><b>Description: </b></td><td><?php echo $row2['description']; ?></td></tr>
</table><br /><br /><br />
<?php
}
?>
So when i do that, i get the following mysql error:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in...
Any way around this?
Note: Before i do the foreach loop, i do a while loop where i loop through a mysql table, which actually succeed. this is the code snippet for the while loop:
$groupname=array();
$sql=mysql_query("SELECT * FROM joined WHERE email='$email'");
while($row=mysql_fetch_array($sql))
{
$groupname[]=$row['group'];
}