codeigniter - Query error in code igniter ( wrong escape ) -


i try insert row in table on code igniter array, going wrong.

that's array:

array (     [date] => 2001-08-15     [number] => 962883     [time] => 17:40     [etc1] => 0     [etc2] => 0       ) 

and insert:

$this->db->insert('mytable', $myarray);  

a new line inserted, columns empty! trying find de error, printed last query

echo $this->db->last_query() ." <br>"; 

and got:

insert `mytable` (`date`, `number`, `time`, `etc1`, `etc2`)  values  ('\02\00\00\01\0-\00\08\0-\01\05\0', '\09\06\02\08\08\03\0', '\01\07\0:\04\00\0', '\00\0', '\00\0')  

for reason can not get, codeigniter ( or php ) wrongly escaping values.

any idea?

firstly change array this:

$data_array = array        (        'date'=> 2001-08-15        'number' => 962883        'time' => 17:40        'etc1' => 0        'etc2' => 0           );   $this->your_model->insert_data($data_array); 

and inside model write function this

  function insert_data($data=array())   {       $this->db->trans_start();       $this->db->insert('your_table_name',$data);       $this->db->trans_complete();       return true;   } 

i hope solve problem


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -