I have read almost every question i have found here and did not get a solution for my problem.
thing is that my query works in phpMyAdmin search but it does not work in codeigniter query.
here is code From phpMyAdmin that works:
SELECT * FROM `pozvani_brojevi`
WHERE `vrijeme_poziva`
BETWEEN '2018-04-05 00:00:00' AND '2018-04-26 00:00:00'
ORDER BY `vrijeme_poziva` DESC
and here is code from codeigniter that don't work:
$this->db->select('*');
$this->db->from('pozvani_brojevi');
$this->db->where('user_id', $user_id);
$this->db->where("'vrijeme_poziva', BETWEEN 2018-04-05 00:00:00 AND 2018-04-26 00:00:00");
$result = $this->db->get();
$pozvani = $result->result_array();
return $pozvani;
note that i have changed code in various ways and always got same result
$this->db->where("vrijeme_poziva, BETWEEN 2018-04-05 00:00:00 AND 2018-04-26 00:00:00");
$this->db->where("vrijeme_poziva BETWEEN 2018-04-05 00:00:00 AND 2018-04-26 00:00:00");
and i get this error message:
Error Number: 1064
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '
00:00:00
AND 2018-04-26 00:00:00' at line 4
SELECT * FROM `pozvani_brojevi` WHERE `user_id` IS NULL AND `vrijeme_poziva` BETWEEN `2018-04-05` `00:00:00` AND 2018-04-26 00:00:00