Database:
| date_paid (int) |
1535558400
1539532800
I am trying to query the following but i get SQL syntax error for the date part.
$id = $this->input->post('id');
$date = $this->input->post('date');
$this->db->where('id',$id);
$this->db->where('DATE_FORMAT(date_paid, "%Y-%m-%d")',$date);
$query=$this->db->get('payments');
$result=$query->row();
Is there any way to change the date format of the column date_paid
so that i can actually compare it to the $this->input->post('date')
data?
Error log:
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 ''2018-10-30'' at line 4
I am trying to modify an existing web application that is why as much as possible i do not want to change the data type of the column date_paid
thanks in advance