Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

date

Status
Not open for further replies.

janet24

Technical User
Jul 22, 2003
161
US
Is there any way you can use the date command to insert the current data in a database through a form?
 
data is not inserted in a database through a form. but a query. forms submit data to a webserver.

you can use the date() function to prepare a date for submission in a query.

if you want to insert a unix time stamp, use
Code:
time();

if you want to insert a mysql-formatted datetime stamp, prepare the value for the query by using
Code:
date("Y-m-d H:i:s");

don't forget to allow for server time offsets.
 
You mean I can use a statement like this and put the date in a variable and into a query?

$date=date("Y-m-d H:i:s");
 
yes.

or you can always do this directly in mysql. but that is outside the scope of the PHP forum.
 
I wonder if it's not working because I'm using bind_param. I'm not getting an error message, I'm just not getting anything so I'm not sure why it isn't working.
 
I got it to work, something else was wrong not the date. Thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top