array( "name" => "name", "lr_score" => "last score", "lr_date" => "last reviewed" ), "way" => $ord_ways, ); $fdefaults = array( "order" => "name", "way" => "ASC", ); $batches = array(); $n = sql( "SELECT batches.id AS id, batches.name AS name, ". "batch_study.id AS bs_id, batch_review.date AS lr_date, batch_review.score AS lr_score ". "FROM batches ". "LEFT JOIN batch_study ON batch_study.batch = batches.id AND batch_study.user = " . $user['id'] . " " . "LEFT JOIN batch_review ON batch_review.id = batch_study.last_review ". "WHERE batches.list = " . $study['listid'] . " " . "ORDER BY " . get_filter("order") . " " . get_filter("way") ); while ($b = mysql_fetch_assoc($n)) $batches[] = $b; require("tpl/study/list.php");