Re: [PHP-DB] Corn job anomaly
> On Sep 23, 2016, at 5:38 AM, Richard > wrote: > > > >> Date: Friday, September 23, 2016 03:28:47 -0500 >> From: Karl DeSaulniers >> >> Ok, so I have run down all the possible things (that I know of) >> that could be keeping this from working. I have checked with my >> hosting service that: >> >> 1. MySQL is accessible with the original user I started with (for >> this case were using db123456) via ssh. 2. The cron is accessing my >> php script fine. >> 3. The cron is running the script and is attempting to access MySQL >> but not allowing access still. >> >> I tried running the script via ssh and it is timing out. No error >> of not accessing MySQL, just telling me it is timing out. This >> tells me (I could be wrong) that it is in fact accessing MySQL and >> that my calls to MySQL are making the script time out? What bothers >> me is that the cron errors out saying access denied but ssh says >> timeout error. Does anyone have any ideas for me to try at this >> point? If I don't get this to work in the next couple of days, I am >> toast! >> > > -- Try the mysql access and commands directly from the command >line (using the mysql cli). > > -- Put debug/print statements in your code so you can clearly >see where you are getting. > >-- 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). > Thanks Richard, That got me thinking and I figured out my access issue... HALELUYA! Now I am getting an error with mysql syntax. "SELECT otn.*, cf.* FROM ".ORDER_TABLE." otn LEFT JOIN ".FIELDS_TABLE." cf ON cf.Order_ID = otn.Order_ID WHERE cf.Earliest_Pickup >= DATE(NOW()) AND cf.Earliest_Pickup <= DATE(NOW() + INTERVAL ".($Num_Days_Away+1)." DAY) AND otn.Order_Status != 'Shipping' AND otn.Order_Status != '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 != \"Completed\"' at line 1 I think at this point my brain is fried and I am not seeing what is wrong with this. Can anyone point out my folly? My guess is it is an obvious one, but I am not seeing it. Thanks again for your help everyone. I think I am almost there! Best, Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Corn job anomaly
On Sun, Sep 25, 2016 at 4:59 AM, Karl DeSaulniers wrote: > > On Sep 23, 2016, at 5:38 AM, Richard innovate.net> wrote: > > > > > > > >> Date: Friday, September 23, 2016 03:28:47 -0500 > >> From: Karl DeSaulniers > >> > >> Ok, so I have run down all the possible things (that I know of) > >> that could be keeping this from working. I have checked with my > >> hosting service that: > >> > >> 1. MySQL is accessible with the original user I started with (for > >> this case were using db123456) via ssh. 2. The cron is accessing my > >> php script fine. > >> 3. The cron is running the script and is attempting to access MySQL > >> but not allowing access still. > >> > >> I tried running the script via ssh and it is timing out. No error > >> of not accessing MySQL, just telling me it is timing out. This > >> tells me (I could be wrong) that it is in fact accessing MySQL and > >> that my calls to MySQL are making the script time out? What bothers > >> me is that the cron errors out saying access denied but ssh says > >> timeout error. Does anyone have any ideas for me to try at this > >> point? If I don't get this to work in the next couple of days, I am > >> toast! > >> > > > > -- Try the mysql access and commands directly from the command > >line (using the mysql cli). > > > > -- Put debug/print statements in your code so you can clearly > >see where you are getting. > > > >-- 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). > > > > Thanks Richard, > That got me thinking and I figured out my access issue... HALELUYA! > > Now I am getting an error with mysql syntax. > > "SELECT otn.*, cf.* FROM ".ORDER_TABLE." otn LEFT JOIN ".FIELDS_TABLE." cf > ON cf.Order_ID = otn.Order_ID WHERE cf.Earliest_Pickup >= DATE(NOW()) AND > cf.Earliest_Pickup <= DATE(NOW() + INTERVAL ".($Num_Days_Away+1)." DAY) AND > otn.Order_Status != 'Shipping' AND otn.Order_Status != '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 != \"Completed\"' at line 1 > > I think at this point my brain is fried and I am not seeing what is wrong > with this. > Can anyone point out my folly? My guess is it is an obvious one, but I am > not seeing it. > > Thanks again for your help everyone. I think I am almost there! > > Best, > > Karl DeSaulniers > Design Drumm > http://designdrumm.com > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > Echo out the query, then manually run it.
Re: [PHP-DB] Corn job anomaly
> Date: Sunday, September 25, 2016 08:37:14 -0400 > From: Aziz Saleh > Subject: Re: [PHP-DB] Corn job anomaly > > On Sun, Sep 25, 2016 at 4:59 AM, Karl DeSaulniers > wrote: > >> > On Sep 23, 2016, at 5:38 AM, Richard wrote: >> > >> > -- Try the mysql access and commands directly from the command >> >line (using the mysql cli). >> > >> > -- Put debug/print statements in your code so you can clearly >> >see where you are getting. >> > >> >-- 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). >> > >> >> Thanks Richard, >> That got me thinking and I figured out my access issue... >> HALELUYA! >> >> Now I am getting an error with mysql syntax. >> >> "SELECT otn.*, cf.* FROM ".ORDER_TABLE." otn LEFT JOIN >> ".FIELDS_TABLE." cf ON cf.Order_ID = otn.Order_ID WHERE >> cf.Earliest_Pickup >= DATE(NOW()) AND cf.Earliest_Pickup <= >> DATE(NOW() + INTERVAL ".($Num_Days_Away+1)." DAY) AND >> otn.Order_Status != 'Shipping' AND otn.Order_Status != '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 != \"Completed\"' at >> line 1 >> >> > > Echo out the query, then manually run it. > Based on the quoting, it doesn't appear that the error you are reporting is actually based on the command syntax you are showing. 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. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Corn job anomaly
Oops. I actually ran it with single and double quotes and got the same error both times. I am using single quotes originally. I think the query is getting the \ (backslash) read literally. I did not add those manually. Best, Karl Sent from losPhone > On Sep 25, 2016, at 9:17 AM, Richard > wrote: > > > >> Date: Sunday, September 25, 2016 08:37:14 -0400 >> From: Aziz Saleh >> Subject: Re: [PHP-DB] Corn job anomaly >> >> On Sun, Sep 25, 2016 at 4:59 AM, Karl DeSaulniers >> wrote: >> On Sep 23, 2016, at 5:38 AM, Richard wrote: -- Try the mysql access and commands directly from the command line (using the mysql cli). -- Put debug/print statements in your code so you can clearly see where you are getting. -- 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). >>> >>> Thanks Richard, >>> That got me thinking and I figured out my access issue... >>> HALELUYA! >>> >>> Now I am getting an error with mysql syntax. >>> >>> "SELECT otn.*, cf.* FROM ".ORDER_TABLE." otn LEFT JOIN >>> ".FIELDS_TABLE." cf ON cf.Order_ID = otn.Order_ID WHERE >>> cf.Earliest_Pickup >= DATE(NOW()) AND cf.Earliest_Pickup <= >>> DATE(NOW() + INTERVAL ".($Num_Days_Away+1)." DAY) AND >>> otn.Order_Status != 'Shipping' AND otn.Order_Status != '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 != \"Completed\"' at >>> line 1 >>> >>> >> >> Echo out the query, then manually run it. >> > > Based on the quoting, it doesn't appear that the error you are > reporting is actually based on the command syntax you are showing. > > 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. > > > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php