<?php
$con = mysql_connect("localhost","username","password"); //connection details
$db = mysql_select_db("databasename",$con); // database details
$qry = mysql_query("SELECT somefield FROM sometable WHERE something = 'somevalue' ")or die(mysql_error()); //actual query
echo "<select name=' '>";
echo "<option></option>"; //if you want the first one to be blank
while ($row = mysql_fetch_array($qry))
{
$i = $row['somefield'];
echo "<option>$i</option>";
}
echo "</select>";
mysql_close($con);
?>
No comments:
Post a Comment