Hello,
I have one form with a field for entering a date 'orderdate' and another field for entering a days interval 'range'.
This form is used to preform a query on a travel tickets database, so that I can search for tickets with dates from ('orderdate') till ('orderdate' + 'range').
For achieving this I have the followiong code:
[php]
"SELECT * FROM viajes WHERE viajes.fecha BETWEEN DATEADD(Day,'". $_GET['rango'] ."','". $_GET['orderdate'] ."') AND '". $_GET['orderdate'] ."'";
[/php]
but Iam getting this error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(Day,'4','2008-03-29') AND '2008-03-29' LIMIT 0, 10' at line 1
I dont know if maybe I should use the mysql function DATE_ADD instead of sql DATEADD function,?
Any help is welcome.
note: at least the information from my form seems to be correctly coded in the query: 2008-03-29, as the error shows