#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    10
    Rep Power
    0
    Hi everybody,

    I want to do the following, I want to make a selection of everything added to my dbase in the last week. I have a date field, called dte and it's format is Y-m-d, when I do a query for that date the reply is something like 2000-08-15. Can anybody help me make the query so that I only get the files that were added last week???

    Thanks a lot in advance!!

    cube
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Location
    London/UK
    Posts
    91
    Rep Power
    15
    $sql = "SELECT * from table where DATE_ADD(my_date_feild, INTERVAL $backdate day) >= DATE_FORMAT(now(),'%Y-%m-%d')";

    where:
    my_date_feild = the date feild in my table
    $backdate = the number of days we're interested in (in this case 7)

    hth

    Bealers

    ------------------
    http://back-end.org
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2000
    Posts
    10
    Rep Power
    0
    Thanks a lot!!!!!!!!!!! It works like a charm!

    cube

Similar Threads

  1. input text : can an input text send 2 value
    By dbosz in forum PHP Development
    Replies: 1
    Last Post: January 28th, 2004, 05:41 AM
  2. IPtables help for rh8
    By climber in forum Linux Help
    Replies: 0
    Last Post: December 1st, 2003, 09:26 PM
  3. Order by number at end of string
    By Ordnas in forum MySQL Help
    Replies: 5
    Last Post: November 27th, 2003, 05:25 AM
  4. Behavior (HTC) problem with input type text
    By korg in forum HTML Programming
    Replies: 0
    Last Post: November 5th, 2003, 08:46 AM
  5. duplicate input in 2 form fields
    By hoagnes in forum PHP Development
    Replies: 3
    Last Post: September 8th, 2003, 08:56 PM

IMN logo majestic logo threadwatch logo seochat tools logo