Hi.
I am pulling rows from 2 databases with a
while ($row = mysql_fetch_array($result2)) {
echo '<li><input type="checkbox" name="food[]" value="'. $id . ','. $dataid['sname'] .','. $row['type'] .','. $row['name'] .','. $row['url'] .'" checked><span>' . $row['type'] . '</span></li>';
$selected[] = '(' . $row['name'] . ')';
}
if (count($result2) > 0) {
echo '<li><span>- - - - - - - - - - - - - - - - - </span></li>';
}
while ($row = mysql_fetch_array($result)) {
echo '<li><input type="checkbox" name="food[]" value="'. $id . ','. $dataid['sname'] .','. $row['type'] .','. $row['name'] .','. $row['url'] .'"><span>' . $row['name'] . '</span></li>';
}
As you can see they are seperated by a dotted line.
The top block pulls out all the rows for the user and echos the
<li>
with a checked checkbox.
The bottom block takes all the rows from the other table and makes
<li>
out of them all.
With this line:
$selected[] = '(' . $row['name'] . ')';
I'm creating an array with the data from the selected database table.
I would like to take this array and its values.. and check them inside the the second block's while loop. Any of the rows that have a matching value to one of the values in the array I would not like to echo.
I'm just confused on how to break apart the array an compare the row with every value in the array before it is echoed in the
<li>
.
Can someone help me fill in ther blanks?