I want to read the single day, month and year, without adding 3 extra MySQL-rows, in this format (with PHP):
day: 01
month: Jan, Feb, Mar..(first three letters)
year: 2011
This is table and PHP script, which I use now:
I add the date with PHP:
mysql_query("INSERT INTO news (...,`time`) VALUES (...'".date(d.".".m.".".Y)."');");
I read it out with:
$query = "SELECT * FROM news";
$result = mysql_query ($query);
while ($row = mysql_fetch_assoc ($result)) {
echo $row['time'];
}
MySQL table:
news:
time(text):
"27.03.2011"
date()incorrectly - the date codes are in a string, so for this (which I'm not recommending, just correcting your code) it would bedate('d.m.Y'). But there's no reason to do that.