Problem solve Get help with specific problems with your technologies, process and projects.

mysql_ functions vs. mysqli object approach

MySQL expert Scott Noyes explains why using mysqli over mysql_functions allows you to take advantage of MySQL's newer features and PHP scripts.

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

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 http://dev.mysql.com/doc/refman/5.0/en/php.html 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 http://dev.mysql.com/downloads/connector/php-mysqlnd/ for more information.

Dig Deeper on Linux servers

Have a question for an expert?

Please add a title for your question

Get answers from a TechTarget expert on whatever's puzzling you.

You will be able to add details on the next page.

Start the conversation

Send me notifications when other members comment.

Please create a username to comment.