Welcome Guest, Not a member yet? Register   Sign In
Using mySQL function for an insert sentence
#1

[eluser]CARP[/eluser]
hi people
I do inserts in the following way

Code:
...
$this->load->database();
$mydate = $array_post["datefield"]; //spanish format date dd-mm-yyyy
$data = array (
    'DATE' => $mydate,
    'AMMOUNT' => $array_post['ammountfield'],
    'COMMENT' => $array_post['commentfield']
);
$this->db->insert('tbl_comission', $data);
...

Now, my question is... what should I do to use a mysql function for the DATE field?
So the generated query can be

Code:
... STR_TO_DATE('$mydate', '%d-%m-%Y')...

This will make mySQL to convert the date so it can be stored in mySQL, without creating a separate php function

Thanks,




Theme © iAndrew 2016 - Forum software by © MyBB