Jump to content

2 x foreach will not work..


Siggles

Recommended Posts

Any ideas will this will not work...

 

case "updateinv":
foreach ($_POST['markedinv'] as $key => $val){

echo "Key: $key; Value: $val<br />\n";
$query = mysql_query("UPDATE timesheet SET marked_invoiced='1' WHERE log_id = '$val' ");

}

foreach ($_POST['cat'] as $key2 => $val2){

echo "Key: $key2; Value: $val2<br />\n";
$query2 = mysql_query("UPDATE timesheet SET marked_invoiced='0' WHERE log_id = '$val2' ");

}

 

but this will

 

case "updateinv":
foreach ($_POST['markedinv'] as $key => $val){

echo "Key: $key; Value: $val<br />\n";
$query = mysql_query("UPDATE timesheet SET marked_invoiced='1' WHERE log_id = '$val' ");

}

 

The echos work for both arrays so I know they exist.

Link to comment
https://forums.phpfreaks.com/topic/145775-2-x-foreach-will-not-work/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.