PHP For loop with differents IDs

Legendary_003

New member
Hello people, everything all right ??

I am with the following doubt, hope you can help me !!

In my "mysql" database I have a list with ID = 1, 3 and 4 and I would like to list them in

"html<select><option></option></select>" !!

I can´t list them like:

PHP:
$sql_list = "SELECT * FROM dados_socios WHERE usuario = '$usuario' ORDER BY ID";
$result_list = $conn->query($sql_list);
    echo "<select>";
    for($x = 0; $x <= $result_list->num_rows; $x++) {
    echo "<option>ID: $x</option>";
    }
    echo "</select>";

Because if I list this way would show:
ID: 1
ID: 2
ID: 3

And I would like the original:
ID: 1
ID: 3
ID: 4

How Can I do that ??
Waiting answer and thanks for the attention !!
One hug
 
Back
Top