简体   繁体   中英

MySQL Syntax Error When Using Data From MSSQL Imported Tables

I have imported a number of tables (structure and data) from an MSSQL DB into mysql - all data is in UTF8

I can pull data from the old tables, but when I use any of the data from the imported tables in a query from PHP I get a syntax error like this:

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 ''data' at line 1

for this query

SELECT * FROM tableName WHERE field='data'

This only happens if executing the query from PHP, if I echo out the query from php and then copy, paste and execute the query from phpmyadmin then it runs fine.

Any ideas???

I'm using PHP 5.2.17 running on Apache 1.3.42 and MySQL 4.1.22-standard

If you using query like this then query should be:

EG "SELECT * FROM tableName WHERE field='data'"; or 'SELECT * FROM tableName WHERE field="data"';

Please check for "Field" data-type whether is Varchar or sumthing else!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM