I am triig to fill options list. I have 2 tables USERS and STREAMS I vant to get all streams and get names of users assigned to that streams.
Users consists of username and id
Streams consists of id, userID, streamID
I try such code:
<?php
global $connection;
$query = "SELECT *
FROM streams ";
$streams_set = mysql_query($query, $connection);
confirm_query($streams_set);
$streams_count = mysql_num_rows($streams_set);
while ($row = mysql_fetch_array($streams_set)){
$userid = $row['userID'];
global $connection;
$query2 = "SELECT email, username ";
$query2 .= "FROM users ";
$query2 .= "WHERE id = '{$userid}' ";
$qs = mysql_query($query2, $connection);
confirm_query($qs);
$found_user = mysql_fetch_array($qs);
echo ' <option value="'.$row['streamID'].'">'.$row['userID'].$found_user.'</option> ';
}
?>
But it does not return USER names from DB=( So what shall I do to this code to see usernames as "options" text?