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
PHP MySQL to MySQli
- a_bertrand
- Posts: 1536
- Joined: Mon Feb 25, 2013 1:46 pm
Re: PHP MySQL to MySQli
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.
Best way? Create yourself a lib or use something done by somebody else.
Creator of Dot World Maker
Mad programmer and annoying composer
Mad programmer and annoying composer
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: PHP MySQL to MySQli
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.
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