#1
  1. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2005
    Posts
    650
    Rep Power
    20

    Count but leave it there?


    hey guys i need to pull up from a databse the clients that are experied.

    i have this that works.but i need to be able to leave it there intill renewed.

    cause if i don't open my application today and there is a pop up saying this client is expiered the next day its not there anymore cause of the current day..

    Code:
    $fileSQL=" SELECT * FROM new_members WHERE date_service_fin = curdate()";
    $fileLIST=mysql_query($fileSQL);
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2006
    Location
    I'm sneaking up behind you.
    Posts
    1,490
    Rep Power
    836
    Code:
    $fileSQL=" SELECT * FROM new_members WHERE date_service_fin <= curdate()";
    Why do we always seek someone, something or some thought? Are we afraid of ourselves?
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2005
    Posts
    650
    Rep Power
    20
    Originally Posted by srisa
    Code:
    $fileSQL=" SELECT * FROM new_members WHERE date_service_fin <= curdate()";
    i tryed that before but the problem was that it shows all the clients with the date afther the current day.

    so if your membership finishes 09-04-09

    it shows but if your membership finishes 09-04-2010

    it shows to since it is past the current date..
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    May 2006
    Location
    I'm sneaking up behind you.
    Posts
    1,490
    Rep Power
    836
    What is the data type for date_service_fin?
    Why do we always seek someone, something or some thought? Are we afraid of ourselves?
  8. #5
  9. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2005
    Posts
    650
    Rep Power
    20
    varchar but a date cause its my script that inserts the date.
  10. #6
  11. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,794
    Rep Power
    4331
    Originally Posted by techker
    varchar but a date cause its my script that inserts the date.
    if you want to do date calculations (e.g. compare to today's date) then you will have to change it from VARCHAR to DATE
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  12. #7
  13. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2005
    Posts
    650
    Rep Power
    20
    Originally Posted by r937
    if you want to do date calculations (e.g. compare to today's date) then you will have to change it from VARCHAR to DATE
    what query will i use?
  14. #8
  15. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,794
    Rep Power
    4331
    Originally Posted by techker
    what query will i use?
    this one --
    Code:
    SELECT columns 
      FROM new_members 
     WHERE date_service_fin <= CURRENT_DATE
    but this will work only if date_service_fin is a DATE column

    Comments on this post

    • techker agrees
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
  16. #9
  17. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Oct 2005
    Posts
    650
    Rep Power
    20
    hmmm thats cool.thx!

IMN logo majestic logo threadwatch logo seochat tools logo