Skip to content Skip to sidebar Skip to footer

Select Options From Mysql Query

I want a select/ dropdown menu with its options coming from the database using mysql select query. PROBLEM: the dropdown menu displays the correct number of items inside the databa

Solution 1:

Change

echo"<OPTION VALUE='".$row[0]."'>".$row[0]."</OPTION>";

to

echo"<OPTION VALUE='".$result[0]."'>".$result]."</OPTION>";

Solution 2:

in $result add this

mysqli_fetch_array($sql, MYSQLI_BOTH)

and

$result[0] instead $row[0]

http://php.net/manual/en/mysqli-result.fetch-array.php

Post a Comment for "Select Options From Mysql Query"