$query = 'select ...'; $result = $conn->query($query); if ($result->num_rows > 0) { while($row = $result->fetch_array()) { echo '<option value="'.$row['field_name_1'].'">'.$row['field_name_1'].'</option>'; } } $result->free(); $conn->close();