通过PHP访问MySQL数据库

以下是资料介绍,如需要完整的请充值下载. 本资料已审核过,确保内容和网页里介绍一致.  
无需注册登录,支付后按照提示操作即可获取该资料.
资料介绍:

中文翻译
通过PHP访问MySQL数据库(中文5000字,英文4100字)
   现在你已经可以熟练地使用MySQL客户端软件来操作数据库里的数据,我们也可以开始学习如何使用PHP来显示和修改数据库里的数据了。PHP有标准的函数用来操作数据库。
  我们首先学习PHP内建的数据库函数,然后会学习PHP扩展和应用程序库(PEAR,PHP Extension and Application Repository )中的数据库函数,我们可以使用这些函数操作所有支持的数据库。这种灵活性源自于抽象。对于编程接口而言,抽象简化了复杂的交互过程。它将交互过程中无关紧要的部分屏蔽起来,让你关注于重要的部分。PEAR的DB类就是这样一种数据库接口的抽象。你登录一个数据库所需要提供的信息被减少到最少。这种标准的格式可以通过同一个函数来访问MySQL以及其他的数据库。同样,一些MySQL特定的函数被更一般的、可以用在很多数据库上的函数所替代。比如,MySQL特定的连接函数是:
   mysql_connect($db_host, $db_username, $db_password);
而PEAR的DB提供的连接函数是:
$connection = DB::connect("mysql://$db_username:$db_password@$db_host/$db_database");
两个命令都提供了同样的基本信息,但是PEAR的函数中还指定了要连接的数据库的类型。你可以连接到MySQL或者其他支持的数据库。我们会详细讨论这两种连接方式。
  本章中,我们会学习如何从PHP连接到MySQL的服务器,如何使用PHP访问数据库中存储的数据,以及如何正确的向用户显示信息。
步骤
无论是通过MySQL命令行工具,还是通过PHP,执行一个查询的基本步骤都是一样的:

Getting PHP to Talk to MySQl
Now that you’re comfortable using the MySQL client tools to manipulate data in the database, you can begin using PHP to display and modify data from the database. PHP has standard functions for working with the database.
First, we’re going to discuss PHP’s built-in database functions. We’ll also show you how to use the The PHP Extension and Application Repository (PEAR) database functions that provide the ability to use the same functions to access any supported database. This type of flexibility comes from a process called abstraction. In programming interfaces, abstraction simplifies a complex interaction.
It works by removing any nonessential parts of the interaction, allowing you to concentrate on the important parts. PEAR’s DB classes are one such database interface abstraction. The information you need to log into a database is reduced to the bare minimum. This standard format allows you to interact with MySQL, as well as other databases using the same functions. Similarly, other MySQL-specific functions are replaced with generic ones that know how to talk to many databases. For example, the MySQL-specific connect function is:
mysql_connect($db_host, $db_username, $db_password); versus PEAR’s DB connect function: