Inserting a timestamp into a mySQL Database?
Posted: Fri Nov 29, 2002 12:43 am
Having another issue, if anyone can help by telling me what I have done wrong.
I keep getting invalid dates in my database, it puts in the date as 00000000000000.
The code looks like this:
And the sql query looks like this:
However after I realised it was not working I outputted the variable $takings_date_timestamp and instead of getting the result I wanted to put into my database, I got 1038528000. Can anyone explain this ? yet I did a conversion on it :
And that works fine, i get the date : Friday 29th November, 2002
Well if anyone can help would appricate it.
Cheers,
SteJ.
I keep getting invalid dates in my database, it puts in the date as 00000000000000.
The code looks like this:
Code: Select all
<?php
$takings_date_timestamp = mktime(0,0,0,$takings_date_month,$takings_date_day,$takings_date_year);
?>Code: Select all
<?php
$returned = mysql_query("INSERT INTO peppersbars_daily_takings VALUES ("$takings_date_timestamp", "$formatted_amount_taken")", $connection) or die("Addition Failed, please try again later");
?>Code: Select all
<?php
$takings_date_display = date("l jS F, Y", $takings_date_timestamp);
?>Well if anyone can help would appricate it.
Cheers,
SteJ.