Site icon Learn Web Development & Programming, Artificial Intelligence, WordPress, Shopify Articles

How to insert data using MySQLi query in php

How to insert data using MySQLi query in php

In this tutorial you will learn how to insert records in a table using MYSQLi query .
Let’s start to create a INSERT INTO statement with values using MYSQLi Procedural and MYSQLi Object-oriented method.
Here we are going to insert a record into user table by specifying coloum fields like: ' user_id', 'first_name', 'last_name', 'email', 'phone'.
Here 'user_id' is an  AUTO_INCREMENT PRIMARY KEY  coloum.

Example: MYSQLi Query

MYSQLi Procedural Method

 

MYSQLi Object-oriented Method

MySQLi Object-oriented method is more faster and secure than MYSQLi Procedural method. That’s the reason we prefer to use MYSQLi Object-oriented method in php.

trong>

 

Exit mobile version