hello,
im trying to add the current date/time to a mysql table in the field 'date', when a user uploads something (so i can later order the uploads by date)
but i just cant figure it...
right now ive got:
<?
mysql_query("INSERT INTO uploads (username, title, description, filepath, date)
VALUES ('$username', '$title', '$description', '$filepath', 'NOW()')")or die(mysql_error());
?>
previously i tried things like adding the current date/ time into a variable($date), and replacing the 'now()' from above with said variable, but it still didnt work
<?
date_default_timezone_set('Europe/London');
$date = date("F j, Y, H:i:a");
?>
my field is set up as a DATETIME type, if that makes a difference?
any help appreciated 🙂
EDIT: jees just as i post i figure it! the date has to be input in the year-month-date order, changed my $date variable to suit.