Hi. I want to retrieve data from a database and display it in the menu list for a client registration form. The data to be displayed is suburb from a table in MySQL called suburbs with columns subid, subname, location and description. I want to use subid to identify the rows and display subname in the menu list How do I do that?
Retrieving columns of data and displaying them in a menu list in a form
Collapse
X
-
You should try the following code inside the <select >tags,to retrive values from db:
1> Estblish the connection:$con n
2>select db:$rs
3>create querry: $sql
4> $rs=mysql_query ($sql,$conn)
or die(mysql_error ());
while($row=mysq l_fetch_array($ rs,MYSQL_ASSOC) )
{
foreach($row as $value)
{
echo("<option value= $value > $value");
}
}
Comment