SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2008
    Location
    Plano, TX
    Posts
    115
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question 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

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,021
    Mentioned
    53 Post(s)
    Tagged
    2 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
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Zealot
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •