mysql Vs mysqli

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
El Vasco
Forum Newbie
Posts: 15
Joined: Tue Jan 04, 2011 12:05 pm

mysql Vs mysqli

Post 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
mikecampbell
Forum Commoner
Posts: 38
Joined: Tue Oct 12, 2010 7:26 pm

Re: mysql Vs mysqli

Post by mikecampbell »

mysqli is recommended.
anantha
Forum Commoner
Posts: 59
Joined: Thu Dec 23, 2010 7:38 pm

Re: mysql Vs mysqli

Post by anantha »

if you are using php version below 5, then use mysql.mysqli is object oriented.i would suggest to use mysqli
User avatar
Darhazer
DevNet Resident
Posts: 1011
Joined: Thu May 14, 2009 3:00 pm
Location: HellCity, Bulgaria

Re: mysql Vs mysqli

Post 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.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: mysql Vs mysqli

Post 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.
El Vasco
Forum Newbie
Posts: 15
Joined: Tue Jan 04, 2011 12:05 pm

Re: mysql Vs mysqli

Post by El Vasco »

Thank You, All for your kind and usefull responses !
BR. El Vasco.
Post Reply