I want to select record based on the current date in codeigniter , but this query fails. -


i have select records based on current system date . if hard code date value , query works fine if modify to

$date1=date('y-m-d h:i:s'); $res=$this->db_model->sql("select * vbl_assignment inner join vbl_student_course on vbl_student_course.course_id = vbl_assignment.course_id inner join vbl_course on vbl_assignment.course_id = vbl_course.course_id vbl_student_course.student_id =".$this->session->userdata('loggedinstudent')->student_id." , vbl_assignment.accept_until_date > ".$date1);   

query fails. idea worng here.

try:

$res=$this->db->query("select * vbl_assignment inner join vbl_student_course on vbl_student_course.course_id = vbl_assignment.course_id inner join vbl_course on vbl_assignment.course_id = vbl_course.course_id vbl_student_course.student_id =".$this->session->userdata('loggedinstudent')->student_id." , vbl_assignment.accept_until_date > '".$date1."'"); 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -