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

Shopify webhook not working when product updated/deleted

python django shopify

Backdrop: Am building a shopify app using a test store provided by shopify. #Python #Django-

What C#/.NET 2.0 RegEx.Replace does if nothing needs to be replaced?

c# regex performance c#-2.0

I'm a bit worried about performance issue when calling RegEx.Replace to really big amount of strings since i have no idea what it does if there's no matches.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.