Voici une fonction de basey_update_enter dans mon modèle de codeigniter qui est exécutée sur la soumission de formulaire réussi.
<?php function update_entry(){ $data = array( 'sl' => $this->input->post('item_sl'), 'item_name' => $this->input->post('item_name'), 'img_url' => $this->input->post('img_url'), 'sound_url' => $this->input->post('sound_url'), 'price' => $this->input->post('price'), 'unit' => $this->input->post('unit'), 'timestamp' => time(), ); echo "current time: ". time(); $this->db->update(MY_TABLE_NAME, $data); } ?>
4 Réponses :
Utilisez la date ;) p> ('y-m-d h: i: s', heure ()); code> p>
mySQL Au lieu de cette P> horodatage code> Le champ Accepter
AAAAY-MM-DD H: I: S code> Format de la date, vous devez donc passer la date à ce format et non l'horodatage UNIX
'timestamp' => date('Y-m-d H:i:s')
@syedrakib: Le char (11) est correct pour le champ d'horodatage
Vous devez fournir une chaîne de titres, pas un entier. Essayez:
'timestamp' => date('Y-m-d H:i:s', time()),
Je pensais que MySQL ait ses capacités de convertir un horodatage UNIX en un horodatage MySQL si Unix Timeestamp est ajouté au champ Timestamp.
Temps de format: Date ('Y-M-D H: I: S', Time ()) Code> P>
Je pensais que MySQL ait ses capacités de convertir un horodatage UNIX à un horodatage MySQL si Unix Timeestamp est ajouté au champ Timestamp .... Merci :)