PHP MySQL to MySQli

C++, C#, Java, PHP, ect...
Post Reply
Zester
Posts: 53
Joined: Sat Mar 03, 2012 11:33 pm

PHP MySQL to MySQli

Post by Zester »

I stated to write my code using MySQL, But I should of used MySQLi as it is better.
Is MySQLi that much Better then MySQL?
How Hard is it to change the code over to MySQLi, is it worth the time?
If so what is the Best way to do it?


Cheers
User avatar
a_bertrand
Posts: 1536
Joined: Mon Feb 25, 2013 1:46 pm

Re: PHP MySQL to MySQli

Post by a_bertrand »

It is MUCH better if you use prepared statements and bind variables. If you pass values within the SQL statement it's as bad as MySQL.

Best way? Create yourself a lib or use something done by somebody else.
Creator of Dot World Maker
Mad programmer and annoying composer
User avatar
Jackolantern
Posts: 10891
Joined: Wed Jul 01, 2009 11:00 pm

Re: PHP MySQL to MySQli

Post by Jackolantern »

Because the standard mysql package has been deprecated, it should no longer be used. It could be removed from a later version of PHP, leaving you with no upgrade path without rewriting your code to use at least mysqli. It is also slower and less secure than mysqli.

Of course, most serious PHP work done today uses PDO at its core, and typically uses some kind of ORM for the actual data access.
The indelible lord of tl;dr
Post Reply

Return to “Coding”