Jump to content

Foreach


Xtremer360

Recommended Posts

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

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.