What i want to do is pull out all of the rows in the below table.
$timeapp_id (this is the users id stored from session)
If the users id is 8 then the returned values of $withComma should be "5 7 34"
What the problem is the line echo $withComma; which is inside the loop outputs the above value, but when echo $withComma; is outside the loop only the last value is returned so when i pass this through $results4 only the last row (which is 34) is displayed.
How do i go about fixing this so that echo $withComma; outside of the loop displays all the results instead of the last row?
$data2b = "select * from user_info where timesheet_approver_1 = $timeapp_id";
$result2b = mysql_query($data2b);
while ($row2b = mysql_fetch_assoc($result2b)) {
$timesheet_approver_1 = $row2b['timesheet_approver_1'];
$timesheet_approver_2 = $row2b['timesheet_approver_2'];
$user_id2 = $row2b['user_id'];
$array = array(" ",$user_id2);
$withComma = implode(" ",$array);
echo $withComma;
}
echo "<br><br>($withComma)";
$results4 = mysql_query("select * from time_data where user_id in ( $withComma ) and status = 'Submitted' order by data_date desc limit $time_entry_display_rows;");