RE: Corn job anomaly
"Ford, Mike" <[email protected]> Tue, 27 Sep 2016 07:24:43 +0000
| Newsgroups | gmane.comp.php.database |
|---|---|
| Message-ID | <[email protected]> |
> -----Original Message----- > From: Karl DeSaulniers [mailto:[email protected]] > Sent: 25 September 2016 09:59 > To: PHP List Database <[email protected]> > Subject: Re: [PHP-DB] Corn job anomaly > > Now I am getting an error with mysql syntax. > > "SELECT otn.*, cf.* FROM ".ORDER_TABLE." otn LEFT JOIN ".FIELDS_TABLE." c= f > ON cf.Order_ID =3D otn.Order_ID WHERE cf.Earliest_Pickup >=3D DATE(NOW())= AND > cf.Earliest_Pickup <=3D DATE(NOW() + INTERVAL ".($Num_Days_Away+1)." DAY)= AND > otn.Order_Status !=3D 'Shipping' AND otn.Order_Status !=3D 'Completed'" > > is giving me 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 > '\"Shipping\" AND otn.Order_Status !=3D \"Completed\"' at line 1 I don't think INTERVAL works like that - you probably need something like: ... cf.Earliest_Pickup <=3D DATE_ADD(CURDATE(), INTERVAL ".($Num_Days_A= way+1)." DAY) AND ... Incidentally, as I understand it CURDATE() does exactly the same as DATE(NO= W()), and is probably more readable. Cheers! Mike -- Mike Ford, Electronic Information Developer, Libraries and Learning Innovation, 110 Queen Square House, 80 Woodhouse Lane, Leeds Beckett University, Leeds LS2 8NU, United Kingdom E & S4B: [email protected] T: +44 113 812 4730 To view the terms under which this email is distributed, please go to:- http://disclaimer.leedsbeckett.ac.uk/disclaimer/disclaimer.html -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php