⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

grocery crud query



Hemant Randive
  • profile picture
  • Member

Posted 30 June 2015 - 11:54 AM

i have code like this i want to select only those records who have todays appointment

 

    public function display_appointment() {
 
        $crud = new grocery_CRUD();
      $crud->set_model('custom_query_model');
        $crud->set_theme('datatables');
   
        $crud->set_table('appointment_details');
       
       $crud->custom_query_model->get_list("SELECT * FROM  appointment_details WHERE date= CURDATE()");
    
        $crud->set_subject('appointment details ');
         $crud->columns('client id','Datetime');
        $crud->display_as('name', 'Name')
                ->display_as('date', 'Date')
                ->display_as('start_time', 'Start Time')
                ->display_as('end_time', 'End Time')
                ->display_as('room_type', 'Room Type')
                ->display_as('mobile', 'Mobile Number');
        $crud->columns('name', 'room_type', 'mobile', 'start_time', 'end_time', 'date');
        $crud->callback_column('start_time',array($this,'format_time'));
        $crud->callback_column('end_time',array($this,'format_time'));
        $crud->order_by('date', 'desc');
        //$crud->order_by('room_type','asc');
        $crud->columns('name','room_type','mobile','date','start_time','end_time');
 
 
        $crud->add_action('create profile', '', 'user/create_client', '', '');
 
        $crud->unset_print();
        $crud->unset_add();
        $outputAppoint = $crud->render();
 
        $this->_example($outputAppoint, (object) array('output' => '', 'js_files' => array(), 'css_files' => array()));
    }
 
 
and my custom model is
 
 
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
 
class Custom_query_model extends grocery_CRUD_model {
 
private  $query_str = ''; 
function __construct() {
 
parent::__construct();
}
 
function get_list() {
$query=$this->db->query($this->query_str);
 
$results_array=$query->result();
return $results_array;
}
 
public function set_query_str($query_str) {
echo"its working";
$this->query_str = $query_str;
}
}
  

i cant get it done.please help me