SQL statement: insertintosomeTablevalues ('20170101', '20160301', '20160301', '20160301', '20160301', 4, '20160301 ', 'panicline', '01', '0. 125 GB * php SQL server operation error
Php operations on SQL server 2000
The SQL statement is:
Insert into someTable values ('20160301', '20160301', '20160301', '20160301', 4, '20160301', 'cyclicline', '01', '0. 125 Gbit/s * 20', 'oral frequently-release dosage form ', 16,1, 16,0, 0, '0', '1', '2017-05-07', 'Up ', '11', 'box', 16, 0, 0, 0, '01', '01', 16, 0, 0, 'zl001', '2017-5-7 ','/', '/','/')
The SQL query analyzer in SQL sever2000 is executed successfully, but an error is reported in php. the code is as follows:
PHP code
The following error is reported:
Link db success!
Warning: mssql_query () [function. mssql-query]: message: row 1st: Syntax error near '01. (Severity 15) in C: \ AppServ \ www \ test \ insert. php on line 14
Warning: mssql_query () [function. mssql-query]: message: String ')' contains unclosed quotation marks. (Severity 15) in C: \ AppServ \ www \ test \ insert. php on line 14
Warning: mssql_query () [function. mssql-query]: Query failed in C: \ AppServ \ www \ test \ insert. php on line 14
Unable to execute SQL: insert into someTable values ('20160301', '20160301', '20160301', '20160301', '20160301', '201601 ', '0. 125 Gbit/s * 20', 'oral frequently-release dosage form ', 16,1, 16,0, 0, '0', '1', '2017-05-07', 'Up ', '11', 'box', 16, 0, 0, 0, '01', '01', 16, 0, 0, 'zl001', '2017-5-7 ','/', '/','/')
Where is the problem? The SQL statement should be okay. why is an error reported? Thank you!
------ Solution --------------------
It may be a problem with escape characters.
'/-'-> '//', Try
------ Solution --------------------
Charset = utf-8 ???
SQL server 2000 does not support UTF-8 encoding
The special character "'" must be converted to "''"
------ Solution --------------------
SQL Server 2000 does not store data in the form of UTF-8, only supports UTF-8 in one critical scenario, that is, supports Extensible Markup Language (XML ), therefore, the SQL Server 2000 database does not support UTF-8 directly.