Page 1 of 1

mysql Vs mysqli

Posted: Tue Jan 04, 2011 12:54 pm
by El Vasco
Hi All,
I am just making my first steps in PHP Scripts and I can see that there are mysql functions and mysqli functions for same purposes...
Which one should I use ? mysql or mysqli functions ? Any criteria to choose using one or the other ?
Thanks !
El Vasco

Re: mysql Vs mysqli

Posted: Tue Jan 04, 2011 1:20 pm
by mikecampbell
mysqli is recommended.

Re: mysql Vs mysqli

Posted: Tue Jan 04, 2011 1:22 pm
by anantha
if you are using php version below 5, then use mysql.mysqli is object oriented.i would suggest to use mysqli

Re: mysql Vs mysqli

Posted: Tue Jan 04, 2011 2:12 pm
by Darhazer
mysql is the older extension and mysqli is the newer one
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

Note:
If you are using MySQL versions 4.1.3 or later it is strongly recommended that you use this extension.

Re: mysql Vs mysqli

Posted: Tue Jan 04, 2011 3:24 pm
by josh
I use Zend_Db which is an object oriented wrapper for PHP'd PDO objects. PDO stands for portable database object, it is portable because it provides a consistent OOP interface across a multitude of databases.

Edit: it stands for "PHP Data objects" I guess... http://us.php.net/pdo

It should do everything mysqli does and more, including prepared statements.

Re: mysql Vs mysqli

Posted: Wed Jan 05, 2011 9:10 am
by El Vasco
Thank You, All for your kind and usefull responses !
BR. El Vasco.