Hyde
12-18-2001, 02:26 AM
Kind of hard to explain for a newbie at php/mysql like me, but I hope some of you get it... :)
I have a MySQL database where all posts have a datetime field.
How can I display all posts that have the date set to today or later?
(In other words: I don't want to display posts with older dates than today)
Database example:
test1 2001-12-17 00:00:00
test2 2001-12-18 00:00:00
test3 2001-12-19 00:00:00
I only want to display 'test2' and 'test3' but not 'test1'
Is there a proper SQL query for this or is additional coding necessary?
This is the code I have now (that shows all posts):
$data = mysql_db_query($database, "SELECT * FROM table1 ORDER BY date");
while ($row = mysql_fetch_array ($data)) {
print $row["date"];
print "<BR>";
print $row["info"];
print "<BR><BR>";
}
I have a MySQL database where all posts have a datetime field.
How can I display all posts that have the date set to today or later?
(In other words: I don't want to display posts with older dates than today)
Database example:
test1 2001-12-17 00:00:00
test2 2001-12-18 00:00:00
test3 2001-12-19 00:00:00
I only want to display 'test2' and 'test3' but not 'test1'
Is there a proper SQL query for this or is additional coding necessary?
This is the code I have now (that shows all posts):
$data = mysql_db_query($database, "SELECT * FROM table1 ORDER BY date");
while ($row = mysql_fetch_array ($data)) {
print $row["date"];
print "<BR>";
print $row["info"];
print "<BR><BR>";
}