Considerations for MySQL database query statements

Source: Internet
Author: User

Help colleagues debug the Code:

$ SQL _insert_user = sprintf ("INSERT INTO cc_user ('CC _ id', 'name', 'Password') values (: cc_id,: name,: password )");

The SQL statement syntax is incorrect and the insert operation cannot be performed.

You can directly execute SQL statements in MySQL.

When phpadmin converts the generated SQL statement into PHP code, it will find that the field attribute is changed to 'CC _ user'

Instead of single quotes.

Because the single quotes in PHP are processed as strings, the field either uses '(the buttons on the Tab) or does not (in this case, the field cannot be a mysql keyword or a reserved word ).

The basics are very important!

Related Article

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: 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.