Date: 11/08/00
- Next message: Rasmus Lerdorf: "Re: [PHP-DB] Date weirdness (php/mysql) (code included)"
- Previous message: Jess Ragaza: "[PHP-DB] Florida, my dear state, is indeed the entertainment center of the world! Very early returns said Bush. Then Gore. Then Bush again. Then this morning for a Florida recount, Gore again."
- Next in thread: Rasmus Lerdorf: "Re: [PHP-DB] Date weirdness (php/mysql) (code included)"
- Reply: Rasmus Lerdorf: "Re: [PHP-DB] Date weirdness (php/mysql) (code included)"
- Maybe reply: John Guynn: "RE: [PHP-DB] Date weirdness (php/mysql) (code included)"
- Reply: Michael Hall: "[PHP-DB] RE: Date weirdness (php/mysql) (code included)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I am storing dates in a MySQL database in the YYYY-MM-DD format.
$thisyear = "2000"; (sets current year)
echo $thisyear."<br>"; (debugging code)
$result = mysql_query("SELECT * FROM news WHERE YEAR(thedate) = '$thisyear'
ORDER BY thedate"); (select statement)
while ($row = mysql_fetch_array ($result)) {
echo "<br>".$row[thedate]."<br>"; (debugging again)
printf ("<h5 class=\"h5headl\">%s </h5>",date("F d, Y",$row[thedate]));
(prints EVERY date as December 31, 1969)
echo "<p class=\"story\">";
printf ("%s <a href=\"mar2000.php3\">%s's
Results</a>",$row[info],date("F",$row[thedate])); (prints EVERY month as
December)
echo "<br>";
}
What am I doing wrong? Is php's date() expecting a different format than
YYYY-MM-DD? The date range from 2000-03-26 to 2000-07-30. Nothing near
1969-12-31.
Ideas or suggestions appreciated.
John Guynn
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe <email protected> For additional commands, e-mail: php-db-help <email protected> To contact the list administrators, e-mail: php-list-admin <email protected>
- Next message: Rasmus Lerdorf: "Re: [PHP-DB] Date weirdness (php/mysql) (code included)"
- Previous message: Jess Ragaza: "[PHP-DB] Florida, my dear state, is indeed the entertainment center of the world! Very early returns said Bush. Then Gore. Then Bush again. Then this morning for a Florida recount, Gore again."
- Next in thread: Rasmus Lerdorf: "Re: [PHP-DB] Date weirdness (php/mysql) (code included)"
- Reply: Rasmus Lerdorf: "Re: [PHP-DB] Date weirdness (php/mysql) (code included)"
- Maybe reply: John Guynn: "RE: [PHP-DB] Date weirdness (php/mysql) (code included)"
- Reply: Michael Hall: "[PHP-DB] RE: Date weirdness (php/mysql) (code included)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

