Results 1 to 3 of 3
  1. #1

    mysql select syntax problems


    I am trying to do a mysql select statement against a table with a field of Real_Date of type DATE. This is the statement:

    $result = mysql_query("SELECT Real_Date, Hour, Hits FROM STATS_BYHOUR WHERE Real_Date >= DATE_ADD(NOW(), INTERVAL -10 DAY)");
    The problem is, the query is only returning from 2006-10-01 forward. I have several dates of 2006-09-30 that are being ignored.

    Any help would be appreciated.


  2. #2
    Join Date
    May 2002
    Kansas City, USA
    Try using CURDATE() rather than NOW(). NOW() produces a Timestamp, rather than just the date.
    Midwest Dedicated
    Content Management Solutions, Design, Managed Servers
    Providing the highest quality IT services since 1999.

  3. #3

    It turned out to be a different problem entirely. I didn't realize the data stream was being truncated. But, you'll be seeing another question real soon.

    (I would have put a smiley face here, but I don't have 5 posts yet)


Posting Permissions

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