[PHP] Re: [PHP-DB] Re: [PHP] Strange Query Error...
On Nov 27, 2010, at 1:24 PM, Don Wieland wrote: On Nov 27, 2010, at 10:44 AM, Daniel P. Brown wrote: Note how you keep changing case here. For example, m.aucciim_id vs. m.AUCCIIM_ID. Also note that all of this is cAsE-sEnSiTiVe. You are right. But it still chokes in PHP: select m.* from Members m inner join Member_Years my on m.AUCCIIM_ID = my.member_id where now() < DATE_ADD(DATE_SUB(concat (member_year + 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.Preferred_First_Name LIKE 'Don%' group by m.AUCCIIM_ID order by m.preferred_last_name Don Don't know if you necessarily need this but I found it while checking to see if one letter names are a good idea in MySQL statements. Might help in your like query. http://techonthenet.com/sql/like.php HTH, Best, Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Query Error...
On Nov 27, 2010, at 12:09 PM, Daniel P. Brown wrote: At this point, can you just send the whole related snippet? The cases keep changing and there's a lot of other suggestions that you said you've tried. Just doing that on my local machine works without error, so it's likely the result of another part of the code --- hence why the query works externally. Thanks Daniel, I did search my code prior to call and found an illegal invisible character. Working now... Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Query Error...
On Sat, Nov 27, 2010 at 14:45, Don Wieland wrote: > Pretty please - I just want to get this working and move on ;-) At this point, can you just send the whole related snippet? The cases keep changing and there's a lot of other suggestions that you said you've tried. Just doing that on my local machine works without error, so it's likely the result of another part of the code --- hence why the query works externally. -- Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Query Error...
On Nov 27, 2010, at 11:35 AM, Daniel P. Brown wrote: Strange... I have no idea what to do. I got to run it via PHP. Don, on which table is the column `member_year` located? Is that on `Members`? it is "Member_Years". I thought of that. I change the query: select m.* from Members m inner join Member_Years my on m.AUCCIIM_ID = my.member_id where now() < DATE_ADD(DATE_SUB(concat(my.member_year + 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.Preferred_First_Name LIKE 'd%' group by m.AUCCIIM_ID order by m.Preferred_Last_Name Still PHP choking and running perfectly in mySQL Workbench. If someone is feeling generous to assist real-time, I am available on SKYPE (skypename = dwdata) and can facilitate a GoToMeeting session. Pretty please - I just want to get this working and move on ;-) Don
Re: [PHP] Strange Query Error...
On Sat, Nov 27, 2010 at 14:30, Don Wieland wrote: > > Strange... I have no idea what to do. I got to run it via PHP. Don, on which table is the column `member_year` located? Is that on `Members`? -- Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Query Error...
On Nov 27, 2010, at 10:39 AM, Tommy Pham wrote: Don, Have you tried to run the query in either MySQL workbench or the command line to ensure that query is SQL syntax error free? From the error message, it sounds more like a SQL syntax error. If you're able to run the query fine in the workbench or the command line, then it's a possibility there's a bug with the mysql extension which I highly doubt. Yes, Tommy. Works fine in mySQL Workbench Strange... I have no idea what to do. I got to run it via PHP. Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Query Error...
On Nov 27, 2010, at 10:44 AM, Daniel P. Brown wrote: Note how you keep changing case here. For example, m.aucciim_id vs. m.AUCCIIM_ID. Also note that all of this is cAsE-sEnSiTiVe. You are right. But it still chokes in PHP: select m.* from Members m inner join Member_Years my on m.AUCCIIM_ID = my.member_id where now() < DATE_ADD(DATE_SUB(concat(member_year + 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.Preferred_First_Name LIKE 'Don%' group by m.AUCCIIM_ID order by m.preferred_last_name Don
Re: [PHP] Strange Query Error...
On Sat, Nov 27, 2010 at 13:18, Don Wieland wrote: > On Nov 27, 2010, at 10:07 AM, Bastien wrote: > >> Try removing the backticks around the table names. If you do use them, >> then all values (field names and table names) need it. > > I tried that and still chokes... > > select m.* from Members m inner join Member_Years my on m.aucciim_id = > my.member_id where now() < DATE_ADD(DATE_SUB(concat(member_year + > 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.Preferred_First_Name > LIKE 'Don%' group by m.AUCCIIM_ID order by m.preferred_last_name > > 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 > 'AND m.Preferred_First_Name LIKE 'Don%'' at line 1 Note how you keep changing case here. For example, m.aucciim_id vs. m.AUCCIIM_ID. Also note that all of this is cAsE-sEnSiTiVe. -- Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Strange Query Error...
> -Original Message- > From: Don Wieland [mailto:d...@dwdataconcepts.com] > Sent: Saturday, November 27, 2010 10:18 AM > To: Bastien > Cc: php-general@lists.php.net > Subject: Re: [PHP] Strange Query Error... > > On Nov 27, 2010, at 10:07 AM, Bastien wrote: > > > Try removing the backticks around the table names. If you do use them, > > then all values (field names and table names) need it. > > I tried that and still chokes... > > select m.* from Members m inner join Member_Years my on m.aucciim_id = > my.member_id where now() < DATE_ADD(DATE_SUB(concat(member_year > + 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND > m.Preferred_First_Name LIKE 'Don%' group by m.AUCCIIM_ID order by > m.preferred_last_name > > 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 > 'AND m.Preferred_First_Name LIKE 'Don%'' at line 1 > > Sigh... > > Don Don, Have you tried to run the query in either MySQL workbench or the command line to ensure that query is SQL syntax error free? From the error message, it sounds more like a SQL syntax error. If you're able to run the query fine in the workbench or the command line, then it's a possibility there's a bug with the mysql extension which I highly doubt. Regards, Tommy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Query Error...
On Nov 27, 2010, at 10:08 AM, Daniel P. Brown wrote: one primary question: are you using the mysql_* family, mysqli_* family, or another method of interfacing with MySQL? mysql_ $results = mysql_query($query) or die(mysql_error()); Don -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Query Error...
On Nov 27, 2010, at 10:07 AM, Bastien wrote: Try removing the backticks around the table names. If you do use them, then all values (field names and table names) need it. I tried that and still chokes... select m.* from Members m inner join Member_Years my on m.aucciim_id = my.member_id where now() < DATE_ADD(DATE_SUB(concat(member_year + 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.Preferred_First_Name LIKE 'Don%' group by m.AUCCIIM_ID order by m.preferred_last_name 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 'AND m.Preferred_First_Name LIKE 'Don%'' at line 1 Sigh... Don
Re: [PHP] Strange Query Error...
On Sat, Nov 27, 2010 at 12:30, Don Wieland wrote: > Hi gang, > > I am executing a query via PHP that gives me a PHP 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 'AND > m.`Preferred_First_Name` LIKE 'Don' AND m.`Preferred_Last_Name` LIKE > 'Wielan' at line 1 > > but when I copy the ECHO of the select query and run it in Sequel Pro Query, > it returns no error. > > Here is the query: > > select m.* from Members m inner join Member_Years my on m.aucciim_id = > my.member_id where now() < DATE_ADD(DATE_SUB(concat(`member_year` + > 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.`Preferred_First_Name` > LIKE 'Don' AND m.`Preferred_Last_Name` LIKE 'Wieland' group by m.AUCCIIM_ID > order by m.preferred_last_name > > What is causing it to choke via PHP? This is actually better-suited to the DB list (CC'd) than the General list, but one primary question: are you using the mysql_* family, mysqli_* family, or another method of interfacing with MySQL? -- Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting (866-) 725-4321 http://www.parasane.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Strange Query Error...
On 2010-11-27, at 12:30 PM, Don Wieland wrote: > Hi gang, > > I am executing a query via PHP that gives me a PHP 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 'AND > m.`Preferred_First_Name` LIKE 'Don' AND m.`Preferred_Last_Name` LIKE 'Wielan' > at line 1 > > but when I copy the ECHO of the select query and run it in Sequel Pro Query, > it returns no error. > > Here is the query: > > select m.* from Members m inner join Member_Years my on m.aucciim_id = > my.member_id where now() < DATE_ADD(DATE_SUB(concat(`member_year` + > 1,'-07-01'), INTERVAL 1 DAY), INTERVAL 30 DAY) AND m.`Preferred_First_Name` > LIKE 'Don' AND m.`Preferred_Last_Name` LIKE 'Wieland' group by m.AUCCIIM_ID > order by m.preferred_last_name > > What is causing it to choke via PHP? > > Thanks! > > Don Try removing the backticks around the table names. If you do use them, then all values (field names and table names) need it. Bastien Koert Sent from my iPhone -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php