PHP and MSSQL 2000 error when inserting data

Source: Internet
Author: User
Tags mssql
Warning:mssql_query () [Function.mssql-query]: message:line 14:incorrect syntax near ' none '. (severity) in function.php on line 22

Warning:mssql_query () [function.mssql-query]: message:unclosed quotation mark before the character string ') '. (severity) in function.php on line 22

Warning:mssql_query () [Function.mssql-query]: Query failed in function.php on line 22

Baidu down, said is the problem of coding, but no matter I put function. PHP code to Utf-8 or gb2312 or report the same error, please friends to help you see


Reply to discussion (solution)

It's possible that your file has a BOM, take out the document BOM and try

Post your SQL instructions!

What is the document BOM on the 2 floor?

Post your SQL instructions!


$command =
"Select DISTINCT
Year (SJ) as Nian
From Dbo.table ";
$dataset =mssql_query ($command, $link);

This is obviously with the error message message:line 14:incorrect syntax near ' none '. (Severity 15) inconsistent

This is obviously with the error message message:line 14:incorrect syntax near ' none '. (Severity 15) inconsistent



Sorry, the wrong file is attached. That should be it.
function Add ($DJ, $SL, $SJ, $MC, $CTMC)
{
Include ". /connect.php ";
$command =
The INSERT into DBO.CANYINZC
(
Dj
Sl
Sj
Mc
Ctingmc
)
VALUES
(
$DJ,
$SL,
CONVERT (DATETIME, ' $SJ ', 102),
' $MC ',
' $CTMC '
)";
$dataset =mssql_query ($command, $link);
}

Echo $command;
See what it is?

Post your SQL instructions!


INSERT into DBO.CANYINZC (DJ, SL, SJ, MC, CTINGMC) VALUES (0, 0, CONVERT (DATETIME, ' 2014 qian? 0?? 0??, 102), ' None ', ' Juan ' ゼ coffin?? ')

The output of the SQL statement becomes garbled.

No environment can not be tested, it should be noted that:
1, MSSQL 2000 only support GBK, so you must use GBK encoding
2. If the field MC is of type nvarchar, the inserted data may need to make a type conversion declaration N ' None '
Other similar
3, MSSQL 2000 Escape special characters ' (single quote) when "(that is, two single quotes)

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.