Skip to main content

Difference Between MYSQL & MYSQLI

MySQL and MySQLi are PHP database extensions implemented by using PHP extension framework. PHP database extensions are used to write PHP code for accessing the database. They expose database API to provide interfaces to use database functions.
MySQL extension is deprecated and will not be available in future PHP versions. It is recommended to use the MySQLi extension with PHP 5.5 and above.

MySQL & MySQLi Difference

There are too many differences between these PHP database extensions. These differences are based on some factors like performance, library functions, features, benefits, and others.
MySQLMySQLi
MySQL extension added in PHP version 2.0. and deprecated as of PHP 5.5.0.MySQLi extension added in PHP 5.5 and will work on MySQL 4.1.3 or above.
Does not support prepared statements.MySQLi supports prepared statements.
MySQL provides the procedural interface.MySQLi provides both procedural and object-oriented interface.
MySQL extension does not support stored procedure.MySQLi supports store procedure.
MySQL extension lags in security and other special features, comparatively.MySQLi extension is with enhanced security and improved debugging.
Transactions are handled by SQL queries only.MySQLi supports transactions through API.
Extension directory: ext/mysql.Extension directory: ext/mysqli.
Note:
Though MySQL extension is deprecated, for backward compatibility it will be available. But do not use if you are starting something new and recommend to migrate the older from mysql to mysqi extension.

Other MySQLi Advantages

  • MySQLi function mysqli_query() allows to enforce error prone queries and prevents bugs like SQL injection.
  • Using MySQLi data fetch, we can get buffered or unbuffered based on server resource size.
  • MySQLi API allows executing multiple queries with single expression using multi_query() function.

Comments

Popular posts from this blog

Build chatbot with node js and react js

User Experience is given a lot of attention while building any application these days. More and more brands are leveraging chatbots to service their customers, market their brand, and even sell their products. There are a lot of awesome tools out there which helps in building an intelligent bot very easily like Google’s DialogFlow, Amazon Lex, etc, most of which implement their own Natural Language Processing (NLP) logic. However, in some cases, we don’t really need an intelligent bot. Whenever we have a small application having a limited set of options to choose from, it’s not really necessary to use NLP based tools like Google’s DialogFlow. You need to integrate with them (which is pretty easy though), and you need to make a network call to get the results. Instead, you would want to define your rules locally in those cases. Here we will build a simple chatbot using React Simple Chatbot library and add it to our pizza-builder app using which we can build ou...

PHP Image Upload with Size Type Dimension Validation

File upload feature requires basic validations to  make clean and hygienic  the user input. There is a huge chance of exploiting a file upload option with malicious intent. Improper implementation of a file upload input increases security vulnerability. We need to validate the uploaded files before saving them on the server to reduce the vulnerability. I have created a HTML form and provided an option to upload files. When the form is submitted, the file binaries are sent to the PHP and validated in the server side. I have checked if the uploaded file is an image and I have specified the allowed image extension, size and dimension based on which the validation is taking place. After all these validations have passed, the image file is saved in the target location as specified. The server-side image file validation takes place in the following aspects. If the file is not empty. If the file extension is one of .jpg, .png, .jpeg. If the file size is le...

Now About PHP Info

Have you ever heard about phpinfo(). Yes, this function is used to know about configuration details of PHP installed in our machine. Such detailed information returned by this phpinfo() includes platform information, PHP and server environment, HTTP header information, PHP core details like version and directives status, License information and etc. phpinfo() function has an optional argument. If this function is called with no argument, then will display all information. We can check it by executing the following code. <? php phpinfo (); ?> We can also request specific details to be displayed to the browser by passing available constants to this function. Following list shows such available options. INFO_GENERAL – This will return information about the platform, compiler, architecture, API and etc. INFO_CREDITS – This option provides a hyperlink which shows details about authors, documentation, QA and infrastructure team. INFO_CONFIGURATION – Disp...