Mightdragon
Mightdragon

Reputation: 15

Problem with requesting data from MySQL and PHP

I have a database and a table that stores the local IP addresses and information for authorization. I try to get the IP of all servers, but I only get the first one. And I don’t know how to fix it, is it even possible?

PHPMyAdmin :

enter image description here

Code :

enter image description here

Upvotes: 1

Views: 384

Answers (1)

Barmar
Barmar

Reputation: 782488

If you want all hosts, don't use a WHERE clause that restricts to certain IDs.

$result = $conn->query("SELECT host FROM baseip");
while ($row = mysqli_fetch_assoc($result)) {
    echo "<option>" . $row['host'] . "</option>";
}

Upvotes: 1

Related Questions