Solved

PHP SQL insert current date statement

Posted on 2013-01-29
2
312 Views
Last Modified: 2013-01-29
What is the statement and value setting for inserting current date to DB using PHP.

 $sql = "INSERT INTO userTable (reg_date) VALUES (?????????)";

Open in new window

0
Comment
Question by:yaron89
2 Comments
 
LVL 10

Accepted Solution

by:
deviprasadg earned 500 total points
ID: 38830071
For MySQL use now().

 $sql = "INSERT INTO userTable (reg_date) VALUES (NOW())";


Refer:
http://stackoverflow.com/questions/7574656/how-to-generate-and-insert-datetime-into-a-mysql-database-php
0
 

Author Closing Comment

by:yaron89
ID: 38830086
NOW() is for current datetime
I found  CURDATE()  for current date
Thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question