Xtremer360 Posted December 21, 2010 Share Posted December 21, 2010 I'm trying to figure out why its saying Warning: Invalid argument supplied for foreach() in /home/content/y/a/n/yankeefaninkc/html/defiant/efedmanager/forms/booking.php on line 17. I thought I did the foreach loop right so far. $eventid = $_GET['id']; $query = "SELECT CONCAT_WS(' ', eventnames.eventname, events.label) AS event, DATE_FORMAT(events.bookingdate, '%M %d, %Y') AS bookingdate, events.nummatches AS nummatches FROM events, eventnames WHERE events.event_id = eventnames.id AND events.id = '" . $eventid . "'"; $result = mysqli_query ( $dbc, $query ); // Run The Query foreach ($nummatches as $matchnum) { echo "Match # $matchnum"; echo "<select class=dropdown name=matchtype id=matchtype title=Match Type>"; echo "<option value=0>- Select -</option>"; $query = 'SELECT id, matchtypename FROM matchtypes'; $result = mysqli_query ( $dbc, $query ); // Run The Query while ( $row = mysqli_fetch_array ( $result, MYSQL_ASSOC ) ) { print "<option value=\"".$row['id']."\">".$row['matchtypename']."</option>\r"; } } Link to comment https://forums.phpfreaks.com/topic/222318-foreach/ Share on other sites More sharing options...
BlueSkyIS Posted December 21, 2010 Share Posted December 21, 2010 what is $nummatches? Link to comment https://forums.phpfreaks.com/topic/222318-foreach/#findComment-1149986 Share on other sites More sharing options...
Xtremer360 Posted December 21, 2010 Author Share Posted December 21, 2010 I just thought of something that's wrong. Nummatches is just the number of matches for the event. Basically what I'm attempting to do is do some form stuff for as many matches for the event. So I need to have it separate out for each match. Link to comment https://forums.phpfreaks.com/topic/222318-foreach/#findComment-1149988 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.