Page 1 of 1

whats batter mysql VS mysqli ?

Posted: Sun Apr 03, 2011 6:53 am
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 .

Re: whats batter mysql VS mysqli ?

Posted: Sun Apr 03, 2011 9:23 am
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

Re: whats batter mysql VS mysqli ?

Posted: Sun Apr 03, 2011 11:11 am
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.

Re: whats batter mysql VS mysqli ?

Posted: Sun Apr 03, 2011 1:50 pm
by xexmple
okay, now i was doing some research and i found PDO class, what the best for handle database ( in OOP ) ?

Re: whats batter mysql VS mysqli ?

Posted: Sun Apr 03, 2011 3:48 pm
by social_experiment
@xexmple : The explanation greyhoundcode gave is probably the best one you will find without searching (:p i almost pasted it myself)

Re: whats batter mysql VS mysqli ?

Posted: Sun Apr 03, 2011 4:51 pm
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?

Re: whats batter mysql VS mysqli ?

Posted: Mon Apr 04, 2011 12:25 am
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.