Skip to content

Instantly share code, notes, and snippets.

@erkattak
Created June 9, 2011 13:40
Show Gist options
  • Save erkattak/1016745 to your computer and use it in GitHub Desktop.
Save erkattak/1016745 to your computer and use it in GitHub Desktop.
Looping SQL results
<?php
// get your sql results, etc
$results = mysql_query('SELECT * FROM table');
?>
<form>
<fieldset>
<legend>Your Legend</legend>
<select name="editlist">
<?php while($row = mysql_fetch_result($results, MYSQL_ASSOC) : ?>
<option value="<?php echo $row['companyname']; ?>"><?php echo $row['companyname']; ?></option>
<?php endwhile; ?>
</select>
</fieldset>
</form>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment