echo MySQL table in <Select> option

Hi all,

My code below is outputting all of my table results out of the options? Any ideas, I think it is something simple but cannot figure it out.

My code is:-
[php]

<?php if (mysqli_connect_errno($db)) { trigger_error('Database connection failed: ' . mysqli_connect_error(), E_USER_ERROR); } $customer = ("SELECT name FROM fms_tbl_customers WHERE client_id= '{$_SESSION['client_id']}' ORDER BY name ASC"); $result = mysqli_query($db, $customer) or trigger_error("Query Failed! SQL: $query - Error: ". mysqli_error($db), E_USER_ERROR); echo ""; echo "SELECT..."; if($result) { while($row = mysqli_fetch_assoc($result)) { { echo "".$row['name'].""; } echo ""; } } mysqli_close($db); ?> [/php]

The connection to the database is made elsewhere and this works as it out puts all of the database table values.

thanks in advance.

solved my issue, here is my updated code for anyone that needs it;-
[php]<?php

$customer = “SELECT name FROM fms_tbl_customers WHERE client_id= ‘{$_SESSION[‘client_id’]}’ ORDER BY name ASC”;
$result = mysqli_query ($db, $customer);

echo “”;
echo “SELECT…”;

while($r = mysqli_fetch_array($result)){
echo “” . $r[‘name’] . “”;
}
echo “”;

mysqli_close($db);
?>[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service