O'Reilly logo

PHP and MySQL for Dynamic Web Sites: Visual Quickpro Guide, Second Edition by Larry Ullman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the Improved MySQL Extension

In Chapter 7, “Using PHP with MySQL,” I introduced the standard set of PHP functions used to interact with a MySQL database. These functions have been around for years and will certainly get the job done. But new to PHP as of version 5 is the Improved MySQL Extension functions, designed to take advantage of features added in MySQL 4.1 (they specifically work with MySQL 4.1.3 and later). If your server meets these requirements, you may want to consider using these functions in your PHP applications. Generally speaking, they are both faster and more secure than the basic MySQL functions.

To start, connect to MySQL using the mysqli_connect() function.

$dbc = mysqli_connect ('localhost', → 'username', 'password'); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required