src/Course.php
//Built finder with DB query string instead of foreach loop. It works :P
Built finder with DB query string instead of foreach loop. It works :P
Built finder with DB query string instead of foreach loop . It works : P
static function find($search_id) {
        $search_course = $GLOBALS['DB']->query("SELECT * FROM courses WHERE id = {$search_id}");
        $found_course = $search_course->fetchAll(PDO::FETCH_ASSOC);
        $course_name = $found_course[0]['course_name'];
        $crn = $found_course[0]['crn'];
        $id = $found_course[0]['id'];
        $new_student = new Course($course_name, $crn, $id);
        return $new_student;
    }
static function find ( $ search_id ) { $ search_course = $ GLOBALS [ 'DB' ] -> query ( " SELECT * FROM courses WHERE id =  { $ search_id } " ) ; $ found_course = $ search_course -> fetchAll ( PDO :: FETCH_ASSOC ) ; $ course_name = $ found_course [ 0 ] [ 'course_name' ] ; $ crn = $ found_course [ 0 ] [ 'crn' ] ; $ id = $ found_course [ 0 ] [ 'id' ] ; $ new_student = new Course ( $ course_name , $ crn , $ id ) ; return $ new_student ; }
Built finder with DB query string instead of foreach loop.
Built finder with DB query string instead of foreach loop .