?
Solved

PHP SQL insert current date statement

Posted on 2013-01-29
2
Medium Priority
?
317 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 10

Accepted Solution

by:
deviprasadg earned 1000 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

New benefit for Premium Members - Upgrade now!

Ready to get started with anonymous questions today? It's easy! Learn more.

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
This article discusses how to implement server side field validation and display customized error messages to the client.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to dynamically set the form action using jQuery.
Suggested Courses

777 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