I have array data that was previously stored like so:
Code:
$allTeams=array('SF','CHI','CIN');
$userTeam=implode(',',$allTeams);
$query = "INSERT INTO users VALUES ('$userTeam')";
Now, I would like to populate a dropdown list with this array data. Here is what I have tried:
Code:
<select name="teamList" id="teamList">
<?php
include 'dbcon.php';
mysql_select_db($database, $conn);
$query = "SELECT userTeam FROM users WHERE fullName='Tim Schutz'";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result))
{
echo '<option value="' . $row['fullName'] . '">' . $row['userTeam'] . '</option>';
}
?>
</select>
The dropdown gets populated, but as one long string as a single item. I tried exploding the data, but nothing shows. Can anyone point me in the right direction?