www.webdeveloper.com
Results 1 to 2 of 2

Thread: MySql 4.1.14-standard AND

  1. #1
    Join Date
    Oct 2005
    Location
    Erie, PA
    Posts
    401

    MySql 4.1.14-standard AND

    I know how to do Basic Querys with PHP and mySql. Yet I have confusion when it comes to mySql date functions. I currently have a Sql statment like so:

    PHP Code:
    <?
    $sql
    ="SELECT * FROM $table_name WHERE `date` BETWEEN DATE_SUB(CURDATE(), INTERVAL 6 DAY) and DATE_ADD(CURDATE(), INTERVAL 1 DAY) ORDER BY 'bar'";
    ?>

    This is the product of people helping me here. What this does (what you probally already know) is take a listing that i enter in at a certain date in the week. and display it for a week then on monday. for the current week.

    I would like to keep with this same format but . I would like it to display from today til one month from now. More inporantly I would like a explanation on how this date thing works because I deal with events and dates are everything. Thanks for any help you can provide me with.

    MySql 4.1.14-standard
    PHP version 4.4.1

  2. #2
    Join Date
    Aug 2005
    Location
    The Garden State
    Posts
    5,634
    you can see all date/time functions in mysql here: http://dev.mysql.com/doc/refman/4.1/...functions.html

    for what you want, you would use between CURDATE() and DATE_ADD(CURDATE(), INTERVAL 30 DAYS)
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles