This is my mutiple select drop down box in edit page. This shows selected items in multiple select in my edit page.but the problem is there is a warning msg Warning: Invalid argument supplied for foreach() in F:\xampplite\htdocs\chem1\admin\edituser.php on line 292 can u see wat is wrong here
[php]$emp_id = $_GET[‘emp_id’];
$result = mysql_query(“SELECT * FROM members WHERE emp_id=$emp_id”)
or die(mysql_error());
$row = mysql_fetch_array($result);
if($row)
{
$login = $row[‘login’];
$email = $row[‘email’];
$type = $row[‘type’];
}
$result1 = mysql_query(“Select *
from members
JOIN lab_employee on members.emp_id = lab_employee.emp_id
JOIN lab on lab_employee.lab_id = lab.lab_id
where members.emp_id=$emp_id”)
or die(mysql_error());
$query=“SELECT * FROM lab”;
$dropdown = “”;
//$dropdown .= "Select lab to assign ";
$result2 = mysql_query ($query);
while($row2 = mysql_fetch_array($result2))
{
$dropdown .= “\r\n<option value=’{$row2[‘lab_id’]}’”;
foreach(mysql_fetch_array($result1) as $row1) // line 292
{
if(($row1[‘lab_id’])==($row2[‘lab_id’]))
{
$dropdown .=" selected=‘selected’";
}
}
$dropdown .= “>{$row2[‘l_name’]}”;
}
$dropdown .= “\r\n”;
echo $dropdown;
[/php]