Jump to content


Photo

MySQL vs MySQLi


  • Please log in to reply
1 reply to this topic

#1 benjaminmorgan

benjaminmorgan

    Advanced Member

  • Member
  • PipPipPipPip
  • 237 posts

Posted 19 November 2011 - 12:32 PM

What is the difference and which one should be used and why?
  • 0
Things should be made as simple as possible, but not any simpler. -Albert Einstein

#2 Ben

Ben

    Administrator

  • Administrators
  • 5,646 posts
  • LocationChico, CA

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...l-injection.php).
  • 0
Benjamin Falk
Falken Creative : Twitter




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users