All pastes #950413 Raw Edit

wkk

public text v1 · immutable
·published 2008-03-20 15:50 UTC
rendered paste body
// Executando a consulta SQL
$query = 'SELECT * FROM clients;';
$result = mysql_query($query) or die('A consulta falhou!: ' . mysql_error());
$options = "";

/* You can add order by clause to the sql statement if the names are to be displayed in alphabetical order */

echo "<select name=client value=''>Cliente</option>";
// printing the list box select command

while($nt=mysql_fetch_array($result)){ //Array or records stored in $nt
        echo "<option value=$nt["client"]</option>";
        /* Option values are added by looping through the array */
}
echo "</select>";// Closing of list box
?>