mysqli vs mysql

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Dave2000
Forum Contributor
Posts: 126
Joined: Wed Jun 21, 2006 1:48 pm

mysqli vs mysql

Post by Dave2000 »

Argh... as soon as I learn one thing I find another way I could do it better...

I just wrote a mysql database/class - now I discover mysqli. (Yeah i know I am a n00b - a better person would have know about mysqli in the first place.) Anyways, should I abandon my mysql class and use the built-in mysqli class??

Thanks

Shears
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Post by califdon »

I don't think I would do that, but maybe someone else may provide an argument for doing so. Disclaimer: Although I've developed a number of relatively simple MySQL databases, I'm nowhere near an expert.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

There are minor differences between the two, but nothing really substantial.
User avatar
nathanr
Forum Contributor
Posts: 200
Joined: Wed Jun 07, 2006 5:46 pm

Post by nathanr »

I think it's down to personal preference, as far as I'm aware, if you want to use cursors, prepared statements, or multiple result sets then you'll be needing mysqli :)
User avatar
AKA Panama Jack
Forum Regular
Posts: 878
Joined: Mon Nov 14, 2005 4:21 pm

Post by AKA Panama Jack »

Even thought Mysqli has been around a long time you will find many shared hosting companies don't have it enabled. So to be safe you should either stick with just Mysql. The otehr alternative is to support both with your class and perform a check to see if Mysqli is enabled and use it instead and if not drop back to Mysql.
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Re: mysqli vs mysql

Post by timvw »

Shears wrote:I just wrote a mysql database/class - now I discover Anyways, should I abandon my mysql class and use the built-in mysqli class??
What does mysqli offer you that you don't have in the mysql extension? And why do you need it?

(Btw, i would find it hard to believe that it would be hard to change the implementation from using mysqli instead of mysql)
Dave2000
Forum Contributor
Posts: 126
Joined: Wed Jun 21, 2006 1:48 pm

Re: mysqli vs mysql

Post by Dave2000 »

timvw wrote:What does mysqli offer you that you don't have in the mysql extension? And why do you need it?
Nothing at the moment. I just heard stuff about it being faster/securer/better; and there may be in the future a time when I want to use some of it's extended functionality... It seems logical to me to use it if it's available. I guess about what Panama Jack said, it's similar to too few people using PHP5 :?

http://devzone.zend.com/node/view/id/686
User avatar
nathanr
Forum Contributor
Posts: 200
Joined: Wed Jun 07, 2006 5:46 pm

Re: mysqli vs mysql

Post by nathanr »

timvw wrote:What does mysqli offer you that you don't have in the mysql extension? And why do you need it?

a few posts back..
nathanr wrote:if you want to use cursors, prepared statements, or multiple result sets then you'll be needing mysqli :)
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

The point i was trying to make is that you shouldn't change something that works unless there is a need for it...

(Imho, updating, just to stay current, without a business need, is a waste of time/money)
Post Reply