Ask the Expert

mysql_ functions vs. mysqli object approach

Is it a bad idea to use mysql_ functions directly instead of going through the mysqli object approach?

Requires Free Membership to View

The mysql_ functions provides a procedural interface to MySQL, and are adequate for many applications. However, they do not take advantage of the newer features to MySQL, including prepared statements and the multiple result sets from stored procedures. For new development, then, mysqli is the better choice. You can still choose whether to use it in a procedural or object-oriented manner. See for more details.

Also note that mysqlnd, a replacement for libmysql, is under development. This new library does not indicate changes to PHP scripts, which will continue to use mysqli functions. Rather, it is a new way for PHP to connect to MySQL "behind the scenes," and offers some performance improvements. See for more information.

This was first published in May 2007

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: