Jump to content

foreach error


astratt

Recommended Posts

Can someone please take a look at this and tell me what I am doing wrong in this for each statement. I am getting this error:

 

Warning: Invalid argument supplied for foreach()

 

below is a snippet of my code:

 

$last_id = mysql_insert_id ();
// INSERT TeamMember IDs
if (!(count($userId) == 1 && $userId[0] == "")) {//dont save if first (blank) option is selected
    foreach($_POST[$userId] as $id){
    	$qry_insert = "INSERT INTO tblTeamMembers (ProjectID, UserID) VALUES('$last_id','$userId')";
        $qry_insert_rs  = $connector->query($qry_insert) or die(mysql_error());
     }
}

 

Any help would be greatly appreciated. Thanks.

Link to comment
https://forums.phpfreaks.com/topic/118767-foreach-error/
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.