mysql grouping problem
Posted: Wed Mar 17, 2010 5:15 pm
hey all,
I need to display a list of times a user has logged in. And i need it to display like this
User Name
time 1
time 2
time 3
Username
time 1
time 2
time 3
but right now my code (below) display's the data like this
User name
time 1
User name
time 2
can anybody help me out? here is code (if you need more info just ask):
I need to display a list of times a user has logged in. And i need it to display like this
User Name
time 1
time 2
time 3
Username
time 1
time 2
time 3
but right now my code (below) display's the data like this
User name
time 1
User name
time 2
can anybody help me out? here is code (if you need more info just ask):
Code: Select all
$sql = mysql_query(" SELECT
*
FROM timeLog
WHERE start BETWEEN '$start_year-$start_month-$start_day' AND '$end_year-$end_month-$end_day'
");
while($row = mysql_fetch_assoc($sql)):
//
extract($row);
//
$sql2 = mysql_query(" SELECT realName FROM module_employees WHERE id = '$employ_id' ");
$row2 = mysql_fetch_assoc($sql2);
//
if($end != '0000-00-00 00:00:00'){
print '<div class="entry">
<h4>'.$row2['realName'].'</h4>';
//
$sql3 = mysql_query(" SELECT * FROM timeLog WHERE id = '$id'");
while($row3 = mysql_fetch_assoc($sql3)):
print $row3['start'];
endwhile;
//
print '</div>';
}
endwhile;