In actual development of small and medium-sized websites, which computing is used to connect to the MySQL database?
Source: Internet
Author: User
In the actual development of small and medium-sized websites, what kind of computing is used to connect to the MySQL database? is it a traditional & nbsp; mysql function or & nbsp; mysqli function or PDO interface method. What are the characteristics and applicability of these three methods? also, I would like to ask: Set character sets. Strictly speaking, should character set names be quoted in actual development of small and medium websites, what kind of computing is used to connect to the MySQL database?
Is a traditional mysql function
Or mysqli function
Or the PDO interface method.
What are the characteristics and applicability of these three methods?
In addition, I would like to ask:
Set the character set. Strictly speaking, should the character set name be enclosed by quotation marks? I think the character set name is a string constant, which may be better, such as the execution speed.
Mysql_query ("set names 'gb2312 '"); shared:
------ Solution --------------------
It should be enclosed in quotation marks, but I don't know anything else. this is what I wrote in the book.
------ Solution --------------------
What kind of computing?
Most of the time, PDO can be used to easily replace various databases, such as MSSQL.
If it is a small system, you will consider using Mysqli
Of course mysql is also in use...
------ Solution --------------------
Mysql <mysqli <PDO
------ Solution --------------------
The new php version uses pdo as the mysql connection method by default, so it is obvious that pdo is becoming more and more popular.
------ Solution --------------------
Give priority to pdo and mysqli, because mysql functions are early php products, which are highly risky and vulnerable to SQL injection attacks. While mysqli and pdo adopt placeholder preprocessing, which makes it safer.
------ Solution --------------------
A small website can be used easily.
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