In the actual development of small and medium-sized websites, what kind of computing is used to connect to the MySQL database? it 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 '");
Reply to discussion (solution)
It should be enclosed in quotation marks, but I don't know anything else. this is what I wrote in the book.
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...
Mysql <mysqli <PDO
I can see that in
How can I earn points? who knows?
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.
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.
A small website can be used easily.