mrkfc
09-02-2011, 11:38 PM
I am trying to make a PHP MySQL script to get multiple results from a database and then display them in a HTML form list.
Here is my current code:
<?php
include_once "connect_to_mysql.php";
$fetchmatch = mysql_query("SELECT * FROM matches WHERE hteam='$team' and played='no'"); //get matches for your team
//get the varialbes into an array
$matchcount = mysql_num_rows($fetchmatch);
while($row2 = mysql_fetch_assoc($fetchmatch)){
$matchid = $row2["id"];
$ateam = $row2["ateam"];
}
$matchname = "$team vs $ateam";
?>
<select name="matchid" id="matchid">
<option value="<?php echo"$matchid"; ?>" selected="selected"><?php echo"$matchname"; ?></option>
</select>
Any help would be appreciated, thanks :)
Here is my current code:
<?php
include_once "connect_to_mysql.php";
$fetchmatch = mysql_query("SELECT * FROM matches WHERE hteam='$team' and played='no'"); //get matches for your team
//get the varialbes into an array
$matchcount = mysql_num_rows($fetchmatch);
while($row2 = mysql_fetch_assoc($fetchmatch)){
$matchid = $row2["id"];
$ateam = $row2["ateam"];
}
$matchname = "$team vs $ateam";
?>
<select name="matchid" id="matchid">
<option value="<?php echo"$matchid"; ?>" selected="selected"><?php echo"$matchname"; ?></option>
</select>
Any help would be appreciated, thanks :)