Is it possible to use a foreach loop for a specific ID in MySQL?
This is what I’m trying to work to (specifically the part: foreach ($row["cid"] )
foreach ($row["cid"] as $value) {
if ($row["v"] == 'x')
{
echo $row["n"];
break;
}
foreach()requires an array as the first parameter. In your example,$row["c_id"]is not an array, so the statement fails.Instead, you can use a
whileloop to process each returned row: