Pulling DATE from database using MySQL and PHP
Hi Guys,
I have a little problem with pulling a DATE from a database. Below is my code for the page I am trying to create.
I have in the database a date – 2011-07-27 and I am trying to set the dates into an array so that I can organise dates into YEAR and MONTH.
Now, I don’t know if the database is the problem. The field is set to DATE.
// Add each entry to the $data array, sorted by Year and Month
while($row = $result->fetch_assoc())
{
$year = date(‘Y’, $row['articleDate']);
$month = date(‘m’, $row['articleDate']);
$data[$year][$month][] = $row;
}
$result->free();
The above code returns 1970 for year and 01 for month.
Help Please
Thank you
View full post on Tycoon Talk
Database, Date, from, mySQL, Pulling, Using