function advise_get_count_of_enrolled_course_for_term

6.x advise.module advise_get_count_of_enrolled_course_for_term($course_id, $term_id)

Returns back an integer for the number of courses which a student was "enrolled" for a certain term. In this situation, we will not make sure the student is "active", since they may have since graduated or something.

File

modules/advise/advise.module, line 359

Code

function advise_get_count_of_enrolled_course_for_term($course_id, $term_id) {

  $res = db_query("SELECT count(distinct(a.student_id)) as mycount  
                   FROM student_courses a, courses c
                   
                   WHERE c.course_id = ? 
                   AND c.delete_flag = 0                   
                   AND a.course_id = c.course_id
                   AND a.term_id = ?
                   ", array($course_id, $term_id));
  $cur = db_fetch_array($res);
  $count = intval(@$cur ["mycount"]);

  return $count;

}