SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: remove by date and time
-
Nov 25, 2008, 07:30 #1
- Join Date
- Apr 2008
- Location
- Plano, TX
- Posts
- 115
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
remove by date and time
i'm trying to remove rows from a db table based on the time it is now and the time they were put in there. here is the table layout
----date-----|-----time----
2008-11-25 --|--08:26:07
2008-11-25 --|--08:26:07
mysql_query("DELETE FROM websites WHERE date = 'yesterday' AND (time is earlier than now) AND id = 'siteID' ");
I'm trying to set up a 24 hour period, 72 hour period, and a full week period, but the 24 is the most important. thanx
-
Nov 25, 2008, 07:53 #2
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
it would be ~so~ much easier if you had designed the table with a single DATETIME column instead of separate DATE and TIME columns
and why do you want to delete them? they're old, just leave them there, for historical purposes if nothing else
-
Nov 25, 2008, 09:05 #3
- Join Date
- Apr 2008
- Location
- Plano, TX
- Posts
- 115
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
well i'm building a program that selects say 2 out of 15 items to display, but it won't display 2 items together that day that displayed together the day before, i'm trying to use the database to decide what not to display. It Selects the items to display based on whats in the don't display table.
display table
item 1, item 5, until 3:30 tomorrow,
item 3, item 8, until 3:30 tomorrow,
item 7, item 12, until 3:30 tomorrow,
it won't display these patterns or the opposite of untill the expire period is over and they are gone from the table
don't display table
item 1, item 2, until 3:30 7 days from now.
item 3, item 5, until 3:30 7 days from now.
item 7, item 4, until 3:30 7 days from now.
I'm still at a stage where i can connect the date column.
but i'll need to be told how to insert that way because i don't know how.
Bookmarks