PHP Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 3.00

MySQL Server Connection and Access Functions

This chapter provides tutorial examples and notes about MySQL server connection with PHP. Topics include configuring the PHP engine to use the MySQL extension library, commonly used MySQL functions, running SQL statements to create table, insert rows and fetch rows.

Configuring PHP for MySQL Server Access

mysql_connect() and Other MySQL Functions

MySqlLoop.php - MySQL Functions Test

Conclusion:

  • PHP supports MySQL through an extension library, php_mysql.dll.
  • Configuring the PHP engine to work with a MySQL server is simple - just turn on the extension=php_mysql.dll in php.ini.
  • A database connection resource must be created with the mysql_connect() function.
  • You can execute any SQL statements using the mysql_query() function.

Dr. Herong Yang, updated in 2009
MySQL Server Connection and Access Functions