CodeIgniter Forums
Setting Data and Time - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Setting Data and Time (/showthread.php?tid=55547)



Setting Data and Time - El Forum - 10-31-2012

[eluser]GabrieleMartino[/eluser]
Hi,

i have troubles with the definition of the field date and inserting the data into the field. I think is a problem of setting of the default value. I set the field as DATETIME without default value. When I access from the controller i set this code

Code:
function add_chat_message($chat_id,$user, $message){
  
  $data = array(
    'message' => $message,
    'user' => $user,
    'chat' => $chat_id,
  );
  
  $this->db->set('date', 'NOW()', FALSE);
  
  $this->db->insert('chat_messages', $data);
}

Firebug is telling me i have a error internal server and the message i got is

Failed loading /usr/lib/php5/<DATE+lfs>/xdebug.so: /usr/lib/php5/<DATE+lfs>/xdebug.so: cannot open shared object file: No such file or directory

In the directory is present the folder 20090626+lfs, the folder libexec and the file maxlifetime.

Idea?


Setting Data and Time - El Forum - 10-31-2012

[eluser]CroNiX[/eluser]
'date' is very bad for a column name, since it's a reserved word in mysql, which means you need to protect it's identifiers in the query.

Its really best to NOT use reserved words as column names.


Setting Data and Time - El Forum - 11-01-2012

[eluser]GabrieleMartino[/eluser]
I changed the name in create_data and it works fine.

Thanks a lot.