Probably a simple solution here, but here is my code:
<?php
include("connect.php");
$data = mysql_query("SELECT * FROM table ORDER BY name");
$info = mysql_fetch_array($data);
?>
and then printing it with:
<select>
<?php
while($info = mysql_fetch_array($data)) {
echo '<option value="'.$info['value'].'" rel="'.$info['del'].'">'.$info['name'].'</option>';
}
?>
</select>
For some reason it’s returning all results except for the very first one? Ex. I’m ordering by name and the first one should be Apples (id = 9), but it’s skipping that and returning Blueberries (id = 5)
Thanks for any help!
You are calling
mysql_fetch_array()immediately aftermysql_query()before your loop, which retrieves one row into$infoand advances the record pointer to the second row. When you then enter your fetch loop, the rowset is already pointing to the second row.