Jump to content

Recommended Posts

So I have a test godaddy account I use for developement before I bring my client sites live.

 

It runs PHP5.x and MySQL 4.1:

 

On my test server I run a query:

SELECT DISTINCT city FROM 'zip_code' WHERE state_name='California' ORDER BY city ASC

 

On the test server this query runs fine.

 

So I upload the client site to my clients godaddy hosting, created the database, the stats are exactly the same PHP5.x and MySQL 4.1

 

But when I try to run that query on the database I get:

#1064 - 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 ''zip_code' WHERE state_name = 'California' ORDER BY city ASC

LIMIT 0, 30' at line 1

 

IM CONFUSED AS HELL?!?! WHy would this query work on my database running the same version, and not on their database which is on the same hosting and same version? I checked and the databases are identicle. :(:(

Link to comment
https://forums.phpfreaks.com/topic/131832-query-works-on-one-server-not-the-other/
Share on other sites

Are the database settings identical on each server?  The standard for mysql is to quote column and table names with backticks (`) and not single quotes.  I think there's a setting to alter that.  Try backticks or removing the quotes from the table name and you should be fine.

The standard for mysql is to quote column and table names with backticks (`) and not single quotes. 

 

No. The 'standard' is to avoid using MySQL reserved words for table or column names.

 

And here they are - http://dev.mysql.com/doc/mysqld-version-reference/en/mysqld-version-reference-reservedwords-5-0.html

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.