What's wrong with this SQL string?

Source: Internet
Author: User
What's wrong with this SQL concatenation? $ nql = "INSERT INTO 'DH _ XXX' ('email ', 'Tel', 'upass ', 'unick', 'sri ', 'Sex', 'Photo ', 'Add', 'sgao', 'xlil', 'xforward', 'ysru', 'ysrid', 'sxiao', 'xzuo ', 'zwjsao', 'hyzkuang ', 'addip', 'addipt', 'mck') VALUES ('". $ email. "','". $ tel. "','". mysql_real_escape_string ($ upass ). "','". mysql_real_escape_string ($ unick ). "','". $ sri. "','". $ sex. "','". $ photo. "','". $ add. "',". $ sgao. ",". $ xli. ",'". $ XREF. "',". yxin. ",'". yxint. "','". $ sxiao. "','". $ xzuo. "','". mysql_real_escape_string ($ zwjsao ). "','". $ hyzkuang. "','". getIPaddress (). "','". getIPS138 (getIPaddress ()). "',". $ site ["examine"]. ")";

Look for someone else


Reply to discussion (solution)

Mysql_query ($ nql) or die (mysql_error ()

..., ". Yxin.", '". yxint ."...

What is this?
If it is a constant, what is the value?

Mysql_query ($ nql) or die (mysql_error ()



The following error is prompted: 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 ')' at line 1

What is it? I'm a little bit PHP. please give me some advice.

..., ". Yxin.", '". yxint ."...

What is this?
If it is a constant, what is the value?



These are variables with single quotes and values. they are non-numeric variables, but not numeric variables.

Is the variable $ ???

Is the variable $ ???



I added it now or reported the error:

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

GetIPaddress () getIPS138 () is the function.
$ Site ["examine"] $ site is a globally defined variable.

After I insert and delete these three variables, it will be normal. isn't it possible to directly call functions and global variables in the concatenation?

All character fields should be enclosed by quotation marks.
Echo $ nql;

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.