I realize that this is old old ground, so please, don't shoot!
I have spent at least 2 hrs searching forums FAQs etc to find the answer to this and I find everything BUT what I need.
I have a table with a column that is of DATE type.
I can pull dates out of this into whatever format I want with the DATE_FORMAT(params) SQL statement. That works like a charm.
How can I get a date from PHP into the database? I am using the following:
$ConvertDate = getdate();
$Year = $ConvertDate["year"];
$Month = $ConvertDate["mon"];
$Day = $ConvertDate["mday"];
$SaveDate =$Year."-".$Month."-".$Day;
Then I send $SaveDate to the DB as part of an INSERT query. However, in SQL the date shows as 0000-00-00 every time. I have tried using just the Date("Y-m-d"); instead of getdate() with the same results. Does anyone know of a way to do this without having to change the column type in the SQL db?
If you help me with this the universe will grant you a new level of spiritual enlightenment.
Thanks
Kalbarg (m7_b5)
I have spent at least 2 hrs searching forums FAQs etc to find the answer to this and I find everything BUT what I need.
I have a table with a column that is of DATE type.
I can pull dates out of this into whatever format I want with the DATE_FORMAT(params) SQL statement. That works like a charm.
How can I get a date from PHP into the database? I am using the following:
$ConvertDate = getdate();
$Year = $ConvertDate["year"];
$Month = $ConvertDate["mon"];
$Day = $ConvertDate["mday"];
$SaveDate =$Year."-".$Month."-".$Day;
Then I send $SaveDate to the DB as part of an INSERT query. However, in SQL the date shows as 0000-00-00 every time. I have tried using just the Date("Y-m-d"); instead of getdate() with the same results. Does anyone know of a way to do this without having to change the column type in the SQL db?
If you help me with this the universe will grant you a new level of spiritual enlightenment.
Thanks
Kalbarg (m7_b5)