I'm trying to get my PHP to display all the product names in a dropdown menu. However it only displays the first row twice.
$prodNameSQL="select prodName from product";
//execute SQL query or return an error
$exeProdNameSQL=mysql_query($prodNameSQL) or die(mysql_error());
//create array of records & populate it with result of the execution of the SQL query
$array=mysql_fetch_array($exeProdNameSQL);
echo "<select name='productCombo'>";
foreach($array as $value) {
echo "<option value=".$value.">".$value;
echo "</option>";
}
echo "</select>";
I know that I should be using mysqli and mysql is depreciated but its beyond my control.
Thanks.