codeigniter db where between
$minvalue = '2020-01-01 00:00:00';
$max_value = '2050-12-31 23:59:59';
$this->db->where("date_field BETWEEN '$minvalue' AND '$maxvalue'");
codeigniter db where between
$minvalue = '2020-01-01 00:00:00';
$max_value = '2050-12-31 23:59:59';
$this->db->where("date_field BETWEEN '$minvalue' AND '$maxvalue'");
like codeigniter
$this->db->like('title', 'match', 'before');
// Produces: WHERE title LIKE '%match'
$this->db->like('title', 'match', 'after');
// Produces: WHERE title LIKE 'match%'
$this->db->like('title', 'match', 'both');
// Produces: WHERE title LIKE '%match%'
codeigniter where order by
$this->db->select('ae_users.employee_id, ae_users.emp_name, ae_users.emp_name2, ae_users.emp_name3');
$this->db->from('ae_users');
$this->db->where_in('ae_users.employee_id',$employee_ids);
$this->db->_protect_identifiers = FALSE; // stop CI adding backticks
$order = sprintf('FIELD(ae_users.employee_id, %s)', implode(', ', $employee_ids));
$this->db->order_by($order);
$this->db->_protect_identifiers = TRUE;
$query =$this->db->get();
// echo '<pre>'; print_r($this->db->last_query());exit;
if ($query->num_rows()) {
return $query->result_array();
} else {
return 0;
}
codeigniter insert
$data = array(
'title' => 'My title',
'name' => 'My Name',
'date' => 'My date'
);
$this->db->insert('mytable', $data);
// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date')
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us