We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 27519
    • 275 Posts
    Hi,

    I need to execute a query with the following where clause:
    where (arrival_date between :aDate and :bDate) or (departure_date between :aDate and :bDate)
    


    I took the approach posted here:
    http://modxcms.com/forums/index.php/topic,43716.msg261297.html#msg261297

    and just wrote out the where clause and then prepared it with the actual values.

    However, the resulting where clause for the query is now:
    where (arrival_date between :'2011-01-01 and :'2011-01-07' or (departure_date between :'2011-01-01' and :'2011-01-07')
    


    This gets flagged off with a syntax error when I use the query in phpmyadmin.

    I’m not an SQL guru but the ":" look suspicious.

    How can I solve this?

    Thanks.
      MODx Revolution / MAMP / OS X
      • 27519
      • 275 Posts
      Oops, my fault.... The where clause is actually ok. There was a typo with a comma.... I need sleep.
      embarrassed
        MODx Revolution / MAMP / OS X
        • 1778
        • 659 Posts
        Have a good night... Sweet dreams, tomorrow is another day!
          • 27519
          • 275 Posts
          Yeah, thanks!
            MODx Revolution / MAMP / OS X