Solved

PHP SQL insert current date statement

Posted on 2013-01-29
2
314 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 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
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 …

689 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