Hi.
Sorry if I've posted in the wrong forum or something - I joined this forum a few seconds ago.
I'm trying to create something which displays all of the users in a database table in a drop-down menu. I've tried this code:
<?php
include 'config.php';
session_start();
$suser = $_SESSION['user'];
$con = mysql_connect($config['mysql_host'], $config['mysql_user'], $config['mysql_pass']);
mysql_select_db($config['database']);
$cpuTable = $config['cpuTable'];
$query = mysql_query("SELECT * FROM $cpuTable WHERE suser='$suser'");
while($row = mysql_fetch_assoc($qa)) {
$users = $row['username'];
echo "
<select name='cpuser'>
<option value='user'>$users</option>
</select>";
}
I created two users in the database - "cp_test1" and "cp_test2", tried the code and it outputted this:
Instead of listing the users in one drop-down menu, it creates two and lists one in each. Can anyone help?
Thanks