Im still fairly new, but should have already worked this one out.
This is my last resort, before i shoot myself. (spend nearly 3 hours surfing the net to find out why this dont work, some one had a simular problem, but it was never soved.)
right, here goes
i have a mySQL database with a table called news.
here is one of the fields :-
Code: Select all
date_of_news timestamp(14)Before i go on, the documentation states this is how many seconds have passed or something from 1970 ? am i right? I have to fill this many seconds 00000000000000 (14 to be right).
fair enough it screws up all my dates.
next, i try to get a date out of the database using the following :-
Code: Select all
$returned = mysql_query("SELECT * FROM news ORDER BY date_of_news DESC LIMIT 0, 3", $connection) or die("Search Failed, please try again later");
$returned_rows = mysql_num_rows($returned);
$handled = 0;
if ($returned_rows != 0)
{
while ($handled < $returned_rows)
{
$row = mysql_fetch_row($returned);
$news_title = $rowї0];
$db_date_of_news = $rowї1];
$details = $rowї2];
$details_large = $rowї3];See Below
Code: Select all
$handled++;
}
}All i want is to store a date in the mySql database that i can sort from past to present, and a way of displaying them in a format of my choice.$today = getdate($db_date_of_news);
$month = $today['mon'];
$mday = $today['mday'];
$year = $today['year'];
Anyone help ?