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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.