$sql_count = "select a.id_learn,count(a.id_learn) from reg_study a
INNER JOIN colearning b ON a.id_learn = b.id_learn
where a.YEAR_CODE = '".$year_n."' and a.TERM_CODE = '".$term_n."'
group by a.id_learn";
$query_count = $db->query($sql_count);
$rec_count = $query_count->fetch(); // rec จำนวนที่นั่ง
echo $rec_count[count("a.id_learn")]
$sql_count = "select a.id_learn,count(a.id_learn) as countID from reg_study a
INNER JOIN colearning b ON a.id_learn = b.id_learn
where a.YEAR_CODE = '".$year_n."' and a.TERM_CODE = '".$term_n."'
group by a.id_learn";
$query_count = $db->query($sql_count);
$rec_count = $query_count->fetch(); // rec จำนวนที่นั่ง
echo $rec_count['countID'];
$sql_count = "select a.id_learn,count(a.id_learn) as xxx from reg_study a
INNER JOIN colearning b ON a.id_learn = b.id_learn
where a.YEAR_CODE = '".$year_n."' and a.TERM_CODE = '".$term_n."'
group by a.id_learn";
$query_count = $db->query($sql_count);
$rec_count = $query_count->fetch();
echo $rec_count["xxx"];