Re: [PHP-DB] Corn job anomaly

[email protected] (Karl DeSaulniers) Sun, 25 Sep 2016 13:55:38 -0500
Newsgroups php.db
Message-ID <[email protected]>
Oops. I actually ran it with single and double quotes and got the same error=
 both times. I am using single quotes originally.=20

I think the query is getting the \ (backslash) read literally. I did not add=
 those manually.=20

Best,
Karl

Sent from losPhone

> On Sep 25, 2016, at 9:17 AM, Richard <[email protected].=
net> wrote:
>=20
>=20
>=20
>> Date: Sunday, September 25, 2016 08:37:14 -0400
>> From: Aziz Saleh <[email protected]>
>> Subject: Re: [PHP-DB] Corn job anomaly
>>=20
>> On Sun, Sep 25, 2016 at 4:59 AM, Karl DeSaulniers
>> <[email protected]> wrote:
>>=20
>>>> On Sep 23, 2016, at 5:38 AM, Richard wrote:
>>>>=20
>>>> -- Try the mysql access and commands directly from the command
>>>>   line (using the mysql cli).
>>>>=20
>>>> -- Put debug/print statements in your code so you can clearly
>>>>   see where you are getting.
>>>>=20
>>>>   -- This includes printing out your mysql statements so that
>>>>      you know exactly what is being passed to mysql (both when
>>>>      you run the script by hand and via cron).
>>>>=20
>>>=20
>>> Thanks Richard,
>>> That got me thinking and I figured out my access issue...
>>> HALELUYAAAAA!
>>>=20
>>> Now I am getting an error with mysql syntax.
>>>=20
>>> "SELECT otn.*, cf.* FROM ".ORDER_TABLE." otn LEFT JOIN
>>> ".FIELDS_TABLE." cf 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'"
>>>=20
>>> 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
>>>=20
>>>=20
>>=20
>> Echo out the query, then manually run it.
>>=20
>=20
> Based on the quoting, it doesn't appear that the error you are
> reporting is actually based on the command syntax you are showing.
>=20
> If after echoing your mysql query, so that you see all substitutions,
> you are still having trouble, then take your query apart and simplify
> it. When you get a trimmed down version to work, then add complexity.
>=20
>=20
>=20
>=20
> --=20
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>=20