Jump to content

Mysqli_connect Vs Mysql_connect?

cjapes's Photo
Posted Mar 14 2011 11:08 AM
31513 Views

Mysqli_connect Vs Mysql_connect?
What's the difference?

Tags:
2 Subscribe


2 Replies

-1
  macnlos's Photo
Posted Mar 14 2011 12:48 PM

There are different opinions on which connector/extension is faster. Here is a simple guideline that you should follow:

If the MySQL database you are connecting to is <= 4.1.3, then use mysql_connect.
If the MySQL database you are connecting to is > 4.1.3, then use mysqli_connect.

Though you can use mysql_connect with newer versions there are certain functions you cannot access. This information was pull from:

PHP.net - go down to the section "What is PHP's MySQL Extension?".

CR
=========================
Sent to you from my
iPad, iPhone, BlackBerry,
Laptop, Desktop, or
Kitchen Toaster
0
  macnlos's Photo
Posted Mar 14 2011 02:15 PM

Looks like someone wasn't a fan of thr first answer. Wonder why? Any feedback? in the abscense of feedback lets try this. Further info from php.net:


What is PHP's mysqli Extension?

The mysqli extension, or as it is sometimes known, the MySQL improved extension, was developed to take advantage of new features found in MySQL systems versions 4.1.3 and newer. The mysqli extension is included with PHP versions 5 and later.

The mysqli extension has a number of benefits, the key enhancements over the mysql extension being:

Object-oriented interface

Support for Prepared Statements

Support for Multiple Statements

Support for Transactions

Enhanced debugging capabilities

Embedded server support
=========================
Sent to you from my
iPad, iPhone, BlackBerry,
Laptop, Desktop, or
Kitchen Toaster