When I execute this code:
$result = mysql_query("SELECT * FROM example_table");
$i = 0;
while ($row = mysql_fetch_array($result))
{
for ($j = 0; $j < $c; $j++)
{
if ($db_array[$j]['ID'] == $row['id'])
{
$del_counter = 0;
break 2;
}
else
$del_counter = 1;
}
if ($del_counter == 1)
{
$del_array[$i] = $row['id'];
$i++;
}
}
This does not break the two level looping. Instead, the $del_array stores all the row ids. I need to compare db_array[][id] with the array "row" (fetched from the database). And need to check which elements of db_array are deleted from the database. So, what I did is I tried to store the ids of deleted items in an array. But the break does not work. Am I missing something?
Thanks in anticipation.
BG
break 2will work as announced, so I would assume you have a logic flaw in your code. Use a step-debugger to see what's your code is doing.else?