organize pages by date
Moderator: General Moderators
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
organize pages by date
I have a column date in my orders table, and i want to make a setup that will allow me to browse my orders by date. The dates are put into the database in this format: 2003-07-03 14:39:42
How would I setup a hyperlink to grab all entries from the third of july of this year from the database and display them all on a database?
How would I setup a hyperlink to grab all entries from the third of july of this year from the database and display them all on a database?
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
I understand that much what I want is to have is the amount of invoices from the day on the page
what kind of sql query would I put for that?
My order admin would look like this:
07-03-2003 - click for orders from this day
07-04-2003 - click for orders from this day
07-04-2003 - click for orders from this day
etc.etc.
How would I make a date somehow pass across pages to grab the invoices from that day when the date is formatted as mentioned above? I know how to get the orders sorted, but I need to know hwo to sort them by the day. any ideas on that?
what kind of sql query would I put for that?
My order admin would look like this:
07-03-2003 - click for orders from this day
07-04-2003 - click for orders from this day
07-04-2003 - click for orders from this day
etc.etc.
How would I make a date somehow pass across pages to grab the invoices from that day when the date is formatted as mentioned above? I know how to get the orders sorted, but I need to know hwo to sort them by the day. any ideas on that?
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
This does kinda work, I get no records from the db when I put in a date like 2003-07-03 because that column formats thing with the 24h timestamp as well
is there a way to just try grab the date and year rather than the rest of the time info in that column?
that's the query and the query is good, its just that it returns no results when I type in
page.php?date_purchased=2003-07-03 because the actual column contents are formatted as such: 2003-07-03 14:22:52
is there anyway to workaround that?
is there a way to just try grab the date and year rather than the rest of the time info in that column?
Code: Select all
<?php
$query_OrderDisplay = "SELECT * FROM orders WHERE date_purchased='$order_date' ORDER BY date_purchased DESC";
?>page.php?date_purchased=2003-07-03 because the actual column contents are formatted as such: 2003-07-03 14:22:52
is there anyway to workaround that?
errm what about a like statement:
This is not ideal I know but you should not hit any problems with this... In theory it should look in the DB and find the records where something like "2003-07-03" appears..
Code: Select all
$query_OrderDisplay = "SELECT * FROM orders WHERE date_purchased LIKE '%$order_date%' ORDER BY date_purchased DESC";-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact:
-
fariquzeli
- Forum Contributor
- Posts: 144
- Joined: Mon Jun 24, 2002 9:16 am
- Location: Chicago
- Contact: