now(); and date(); function in code igniter give zeros result

So i want to insert current time to mysql database, this is my code :

'regis_date'=>$this->input->post(date('Y-m-d H:i:s', now()))

But the result is this : 0000-00-00 00:00:00 What i want is like this (for example) : 2012-08-31 00:00:00 Thanks :D

Answers


$this->input->post is for retrieving data posted through a form.

E.g.:

<input type="text" name="regis_date" />

Can be retrieved like this:

$this->input->post('regis_date');

Passing a date to $this->input->post doesn't make any sense. What you want is:

'regis_date' => date('Y-m-d H:i:s', now())

Or as zerkms rightfully remarks:

'regis_date' => date('Y-m-d H:i:s')

Try this code

'regis_date'=>'NOW()'

Edited Use this one . . It works for sure . .

'regis_date'=>date("Y-m-d H:i:s")

Need Your Help

iOS and Cocos2d: my app REALLY slow on simulator but is FINE on device

ios xcode cocos2d-iphone ios-simulator

..I am wondering whether there is some setting I should change to get my iOS 5.0 app running fine on an iPhone IOS 5.0 simulator. It runs at only 12fps instead on my device runs at 60fps. Any help? I

In HTML5 Canvas, can I make the y axis go up rather than down?

javascript html5 canvas

I'm drawing a graph in Canvas and struggling with the fact that the y-axis is "backward." The origin is in the top-left corner, and increasing values go down rather than up.