MySQL Forums
Forum List  »  Newbie

date field in database shows 0000-00-00 00:00:00
Posted by: LaTicca Peeples
Date: August 18, 2005 09:31AM

i have the following in my list of variables (partial list):
$id = $_POST['id'];
$name = $_POST['name'];
$date = date("D, d M yyyy, h:ia T");

and my connection includes:
$sqlquery = "INSERT INTO $table VALUES('$id','$name','$date')";

all other values are posting except the date.

in the mysql database, the date field is set up as follows:

Field Type Null Default
date timestamp Yes CURRENT_TIMESTAMP


my objective is simply to add a date field with the current date and time.
i want mysql to insert the date for me in the format resulting in this type of output:
Fri, 19 Aug 2005, 10:23am CST. i just wasn't sure whether i was supposed to
include the date variable or not.

please advise.

Options: ReplyQuote


Subject
Written By
Posted
date field in database shows 0000-00-00 00:00:00
August 18, 2005 09:31AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.