I’ve been consulting stack overflow for quite some time now.
I’m developing a system for article management and I encountered a problem.
How do I echo a field values to a dropdown select from a database table?
I have managed to echo it using this:
$result = mysql_query("SELECT catName FROM tblCat");
while($row = mysql_fetch_array($result)){
echo "$row['catName']";
echo "`<br />`";
}
But when I edited the code to this:
$result = mysql_query("SELECT catName FROM tblCat");
while($row = mysql_fetch_array($result)){
echo "`<select>`";
echo "`<option value='{$row['catName']}'>`";
echo "`</select>`";
}
I got no result.
1 Answer