prepare("SELECT tb.id, ts.name AS time_sequence, tb.name AS time_block FROM time_blocks AS tb INNER JOIN time_sequences AS ts ON (ts.id=tb.sequence) ORDER BY ts.id ASC, tb.name ASC");
$sql->execute();
$tbs=array();
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
echo "
".$row['time_sequence']." ".$row['time_block']."
";
array_push($tbs, $row['id']);
}
?>
fetch(PDO::FETCH_ASSOC)){
echo "
";
echo "
".$row['id']."
";
echo "
".$row['name']."
";
echo "
".$row['class']."
";
$i=0;
$sql=$db->prepare("SELECT r.id AS regid, tb.id AS time_block, p.name FROM registrations AS r INNER JOIN programs AS p ON (p.id=r.program) INNER JOIN time_blocks AS tb ON (tb.id=p.time_block) WHERE r.user=:uid ORDER BY tb.sequence ASC, tb.name ASC");
$sql->execute(array(":uid"=>$row['id']));
while($row2=$sql->fetch(PDO::FETCH_ASSOC)){
while($row2['time_block']!=$tbs[$i]){
echo "
prepare("SELECT u.id, u.name, u.class, (SELECT COUNT(r.id) AS count FROM registrations AS r WHERE r.user=u.id) AS progcount FROM users AS u WHERE u.accesslevel=0 and u.id<>1 and (SELECT COUNT(r.id) AS count FROM registrations AS r WHERE r.user=u.id)<:pc GROUP BY (u.id)");
$sql->execute(array(":pc"=>$config['general']['programs_needed']));
while($row=$sql->fetch(PDO::FETCH_ASSOC)){
echo "