In the current development of small and medium-sized web sites, what kind of calculation is used to connect MySQL database?

Source: Internet
Author: User
It's a traditional MySQL function.
or the MYSQLI function.

Or the method of the PDO interface.

What are the characteristics and applicability of these three methods?

In addition: I want to ask one thing:
Setting the character set, strictly speaking, whether the character set name should be quoted, I think the character set name is a string constant, causing the better, such as the speed of execution.
mysql_query ("Set names ' gb2312 '");


Reply to discussion (solution)

It should be enclosed in quotation marks, but nothing else is known, and that's what the book says.

What kind of calculation?

Most of the time, PDO can easily replace various databases such as MSSQL
If it's a small system, then consider using mysqli
Of course, MySQL is also in use ...

MySQL < mysqli < PDO

I'll take a look at

How to get points, who knows?

The new version of PHP defaults to the PDO as a connection method for MySQL, so it is clear that PDO is more and more popular.

Choose PDO and Mysqli first, because MySQL functions are very risky and vulnerable to SQL injection attacks because they belong to the early PHP product. Mysqli and PDO are more secure by using placeholder preprocessing.

Small web site generally, that's convenient.

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