as part of a HTML form I am creating I would like to have a dropdown list which will list all the usernames in my database.
I thought the following code would do the
Use OOP concept instead. Create a class with function
class MyClass {
...
function getData($query) {
$result = mysqli_query($this->conn, $query);
while($row=mysqli_fetch_assoc($result)) {
$resultset[] = $row;
}
if(!empty($resultset))
return $resultset;
} }
and then use the class object to call function in your code
getData("select city_name from city");
?>
Full code and description can be found here