whats batter 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
xexmple
Forum Newbie
Posts: 6
Joined: Thu Mar 31, 2011 5:06 pm

whats batter mysql VS mysqli ?

Post by xexmple »

hey,

i wanna class for handle database, and i'm don't know what to use mysql or mysqli.

mysql more familiar for me, but few people think that mysqli is more useful what you think ?

if you think mysqli more useful you can give an exemple code.

thanks a lot and i'm sorry about my typo english .
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: whats batter mysql VS mysqli ?

Post by social_experiment »

Mysqli isn't so much different from mysql in terms of syntax so you shouldn't struggle with it.
MySQLi&btnG=Google+Soek
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: whats batter mysql VS mysqli ?

Post by greyhoundcode »

A lazy way of answering I know, but (highlighting is mine) ...
PHP Manual wrote: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

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

As well as the object-oriented interface the extension also provides a procedural interface.
xexmple
Forum Newbie
Posts: 6
Joined: Thu Mar 31, 2011 5:06 pm

Re: whats batter mysql VS mysqli ?

Post by xexmple »

okay, now i was doing some research and i found PDO class, what the best for handle database ( in OOP ) ?
User avatar
social_experiment
DevNet Master
Posts: 2793
Joined: Sun Feb 15, 2009 11:08 am
Location: .za

Re: whats batter mysql VS mysqli ?

Post by social_experiment »

@xexmple : The explanation greyhoundcode gave is probably the best one you will find without searching (:p i almost pasted it myself)
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: whats batter mysql VS mysqli ?

Post by greyhoundcode »

xexmple wrote:okay, now i was doing some research and i found PDO class, what the best for handle database ( in OOP ) ?
Well both offer an object-oriented approach, so it's horses for courses really. It's usually highlighted at this point that PDO offers a common way to access various types of database, not just MySQL, but if you're going to be working exclusively with MySQL anyway that's not a massive plus point.

I have also read that mysqli is faster than PDO, which perhaps isn't too surprising as it is focused exclusively on one technology, however it is probably better to choose the one you are most comfortable working with.

With that in mind, why not write some test code for each and see what you prefer?
xexmple
Forum Newbie
Posts: 6
Joined: Thu Mar 31, 2011 5:06 pm

Re: whats batter mysql VS mysqli ?

Post by xexmple »

thanks for the useful comments.
and for your question i prefer to use in what the best for my websites, even if i will be need to learn more and struggle.
if mysqli really faster, i will use this class, like you say i will check it out.
thanks a lot.
Post Reply