Page 1 of 1

mysqli - Use the class (OO) or functions?

Posted: Wed Aug 26, 2009 4:01 pm
by Kev
Hi Guys,

I'm switching to using the mysqli extension (coming from mysql) and can't quite figure out how one should decide whether to use the OO mysqli approach or the procedural mysqli approach. I've done some searching and research, but haven't been able to figure out what advantages one might have over the other. I tend to mix my scripts with OOP and procedural code, so it's not like I usually code one way or the other. I'd also like to know which approach you take.

Thanks for your advice and guidance!

Kevin

Re: mysqli - Use the class (OO) or functions?

Posted: Wed Aug 26, 2009 4:08 pm
by Eran
MySQLi is OO based in nature but also allows for procedural style, to ease the migration for people more used to it. You should use the syntax that integrates the best with your own source code, there is no specific advantage to using one over the other (though I think not all OO methods are available as functions as well).