What is the difference and which one should be used and why?
Page 1 of 1
MySQL vs MySQLi
#1
Posted 19 November 2011 - 12:32 PM
Things should be made as simple as possible, but not any simpler. -Albert Einstein
#2
Posted 19 November 2011 - 03:45 PM
See http://uk3.php.net/m...li.overview.php
On the surface, both do about the same thing -- allow you to communicate with a database. MySQLi has some advantages though:
- object-oriented interface
- support for prepared statements (which prevent SQL injection)
- support for multiple statements
- support for transactions
- enhanced debugging capabilities
- embedded server support.
I would definitely suggest going with MySQLi or PDO over plain MySQL, since both MySQLi and PDO support prepared statements, which allow you to escape any data that you use in your queries, preventing SQL injection (http://www.tizag.com...injection.php).
On the surface, both do about the same thing -- allow you to communicate with a database. MySQLi has some advantages though:
- object-oriented interface
- support for prepared statements (which prevent SQL injection)
- support for multiple statements
- support for transactions
- enhanced debugging capabilities
- embedded server support.
I would definitely suggest going with MySQLi or PDO over plain MySQL, since both MySQLi and PDO support prepared statements, which allow you to escape any data that you use in your queries, preventing SQL injection (http://www.tizag.com...injection.php).
Benjamin Falk | Falken Creative : Twitter : KillerSites Screencast Blog
Skills: Photoshop, Illustrator, HTML, CSS, jQuery, PHP and CodeIgniter
Skills: Photoshop, Illustrator, HTML, CSS, jQuery, PHP and CodeIgniter
Share this topic:
Page 1 of 1

Help












