Why doesn't this code work?

From: Date: Wed, 16 Apr 2003 00:06:57 +0000
Subject: Why doesn't this code work?
Groups: php.general 
Request: Send a blank email to php-general+get-144041@lists.php.net to get a copy of this message
I am getting two arrays from a form p_id and event_id, what I need is for each of the values in the p_id array to then loop through the event_id so the result would be: p_id[1] event_id[1] event_id[2] p_id[2] event_id[1] event_id[2] p_id[3] event_id[1] event_id[2] However the result I get is: p_id[1] event_id[1] event_id[2] p_id[2] p_id[3] Any help on what I am doing wrong is GREATLY appreciated. $array1 = $GLOBALS['p_id']; while(list($value1, $value2)= each ($array1)){ list($performance_id,$preference)= split (",", $value2); echo $performance_id . " -- " . $preference . "<br>"; foreach ($event as $event) { list($event_id, $username)= split (",", $event); echo $performance_id . " -- " . $preference . "<br>"; echo $event_id . " -- " . $username . "<br>"; $SQLstr = "SELECT id FROM performance_event WHERE perf_id = $performance_id AND event_id = $event_id"; $results = mysql_query($SQLstr); list($perf_event_id) = mysql_fetch_row($results); echo $perf_event_id . "<br>"; } }

« previous php.general (#144041) next »