Do I need to add the 'symbol to the mysql statement? What should I do?

Source: Internet
Author: User
Do I need to add the 'symbol to the mysql statement? 'The mysql statement with this symbol can avoid errors when the field name or table name is a keyword of the SQL statement. However, this system can only use the MYSQL database. if you want to change the database, do we need to add these statements to the development system ?, 'Is the mysql escape character. do you want to add the' symbol if you are not in the mysql statement?
'The mysql statement with this symbol can avoid errors when the field name or table name is a keyword of the SQL statement. However, this system can only use the MYSQL database. if you want to change the database, do we need to add these statements to the development system?

------ Solution --------------------
'Is the mysql escape character. you do not need to escape it if you do not use the reserved words or Chinese characters of mysql in the column name or table name.
Other databases also have reserved words, which also need to be escaped if used, but the escape characters are different.

As long as you do not use reserved words, you do not need to escape them.
------ Solution --------------------
It only means that you have not performed code design on the database operation.

PHP code
Class database {public function Quote ($ t) {return $ t;} class mysql extends database {public funciton Quote ($ t) {return "'". $ t. "'" ;}} class sqlite extends database {}

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.