Professional Web Applications Themes

Mysql Results for > 2 Days Ago - Macromedia Dynamic HTML

Hi All, I think I mistakenly posted this under the wrong heading before... I am making a site for a band and would like to have a section of the site that shows when their performances will be. I'd like this to show all upcoming events plus any events that have happened within the last 2 days. Right now I have my mysql query set up with "WHERE Shows.show_date >= NOW()" and that works OK but is there a way to also pull the data for events from 2 days prior to NOW()? I'm using mysql and php. Thanks in ...

  1. #1

    Default Mysql Results for > 2 Days Ago

    Hi All,

    I think I mistakenly posted this under the wrong heading before... I am making
    a site for a band and would like to have a section of the site that shows when
    their performances will be. I'd like this to show all upcoming events plus any
    events that have happened within the last 2 days.

    Right now I have my mysql query set up with "WHERE Shows.show_date >= NOW()"
    and that works OK but is there a way to also pull the data for events from 2
    days prior to NOW()?

    I'm using mysql and php.

    Thanks in advance for any help/suggestions you might have!

    sfopp Guest

  2. #2

    Default Re: Mysql Results for > 2 Days Ago

    sfopp wrote:
     
    "WHERE Shows.show_date > (NOW()- INTERVAL 3 DAY)"

    Mick
    Mick Guest

  3. #3

    Default Re: Mysql Results for > 2 Days Ago

    Mick White wrote: 

    I don't think that will work. It should be this:

    "WHERE Shows.show_date > SUBDATE(NOW(), INTERVAL 3 DAY)"

    --
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/
    David Guest

  4. #4

    Default Re: Mysql Results for > 2 Days Ago

    ..oO(David Powers)
     
    >
    >I don't think that will work. It should be this:
    >
    >"WHERE Shows.show_date > SUBDATE(NOW(), INTERVAL 3 DAY)"[/ref]

    I also didn't know about this shorthand syntax until a month ago or so,
    but in fact it works and it is doented.

    Micha
    Michael Guest

  5. #5

    Default Re: Mysql Results for > 2 Days Ago

    Michael Fesser wrote: 

    Really? I stand corrected. Is it limited to more recent versions? Yes,
    I'll go and have a look at the doentation myself, but it would be
    useful to indicate here if there are any limitations on it.

    --
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/
    David Guest

  6. #6

    Default Re: Mysql Results for > 2 Days Ago

    David Powers wrote: 

    I'll answer my own question. It's been available since MySQL 3.23, so
    works in all current versions. Useful to know.

    --
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/
    David Guest

  7. #7

    Default Re: Mysql Results for > 2 Days Ago

    David Powers wrote:
     
    >
    >
    > I don't think that will work. It should be this:
    >
    > "WHERE Shows.show_date > SUBDATE(NOW(), INTERVAL 3 DAY)"
    >[/ref]
    Your MySQL connection id is 79 to server version: 4.1.22-standard
    mysql> select NOW()- INTERVAL 3 DAY;
    +-----------------------+
    | NOW()- INTERVAL 3 DAY |
    +-----------------------+
    | 2008-01-16 10:40:14 |
    +-----------------------+
    1 row in set (0.00 sec)

    mysql> Select NOW();
    +---------------------+
    | NOW() |
    +---------------------+
    | 2008-01-19 10:40:33 |
    +---------------------+
    1 row in set (0.00 sec)

    Mick
    Mick Guest

Similar Threads

  1. Problem with slow mysql after 5 days
    By dalouis in forum MySQL
    Replies: 7
    Last Post: January 6th, 09:49 AM
  2. #39560 [NEW]: Inconsistent behaviour of strtotime when days > days in month
    By php at colin dot guthr dot ie in forum PHP Bugs
    Replies: 1
    Last Post: November 20th, 05:21 PM
  3. Replies: 4
    Last Post: March 23rd, 11:21 AM
  4. Display month and days with results
    By Andy Hassall in forum PHP Development
    Replies: 0
    Last Post: August 17th, 05:10 PM

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
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139