This is driving me nuts!
I have created a query. The query is written to Windows file for future connection to the remote database.
Upon the connection using cURL, my local script uses cURL to send the query. I assemble variables using build_http_query. The cURL works just fine but the query fails. Every time. mySQL complains that query is syntactically wrong but it is CORRECT in every way. I copied the query that the sql complained - I wrote, "die($sql)" so I could copy the string of the query. I pasted it into myPHPadmin and it executed without problems. I know it had no problem connecting to the database otherwise it would die with "cannot connect to db" or "unable to connect because of wrong login" error. It always end up saying that the query itself is wrong.
I copied the query into the server side script and it failed as well even though there is NOTHING wrong with it. I had it output to the web browser and I copied it to phpadmin... it executed fine.
I thought it was something to do with newlines/returns. I removed all of them using replace function. I even code to write queries with no newlines or returns. I used semicolon to separate queries.
But it doesn't matter - it works perfectly in phpAdmin yet it failed when hard coded into the script or reading from the file!
What do you think is the issue?
UPDATE: got it working but exactly what changed was that I simply retyped the same query from the original source and it just worked. I think there's something "invisible" or a character that looks legal but is not legal that caused the query to fail.
Sorry for not editing my original question, sure didn't realize there's "Edit" link.