SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard spence_noodle's Avatar
    Join Date
    Jan 2004
    Location
    uk, Leeds (area)
    Posts
    1,264
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)

    Question How to select data 1 day before...

    Hi folks,

    This has got me scratching my head. I'm trying to select data 1 day before the expiry date, but too no avail.

    Here's my code (by the way, I'm using MySQL client version: 5.0.27 on my PC and MySQL client version: 4.1.21 on the web server):

    Code:
    $endresult = mysql_query(" SELECT photo_id, photo_caption, photo_category FROM gallery_photos WHERE photo_expire_date =  DATE_SUB(CURDATE(),INTERVAL -1 DAY) ");
    The dates are placed as for example: 2007-02-17 into the database.

    Any ideas where I'm going wrong?

    Cheers,

    Spence
    "Don't you just love it when you solve a programming bug only to create another."

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,340
    Mentioned
    63 Post(s)
    Tagged
    3 Thread(s)
    what does "no avail" mean? does your query run? does it produce a syntax error?

    by the way, you realize that subtracting -1 day is the same as adding 1 day, right?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Wizard spence_noodle's Avatar
    Join Date
    Jan 2004
    Location
    uk, Leeds (area)
    Posts
    1,264
    Mentioned
    2 Post(s)
    Tagged
    1 Thread(s)
    Don't worry about what does "no avail" means.

    As for any errors, no.

    And yes I do.

    In the end (I got it too work) it was Xampp and Dreamweaver playing up on my PC.

    Thank you for your time Rudy,

    spence
    "Don't you just love it when you solve a programming bug only to create another."


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
  •