Using this function you can run all database query like INSERT, UPDATE, DELETE data into the table.

$con=mysqli_connect(“localhost”,”root”,””,”my_db”); // database local connection
// Connection
if (mysqli_connect_errno())
echo “Failed to connect to MySQL: ” . mysqli_connect_error();

//  Queries
mysqli_query($con,”SELECT * FROM user”); // Select data from table
mysqli_query($con,”INSERT INTO user(FirstName,LastName,Age)
VALUES (‘jay’,’amin’,33)”); // insert data into table
mysqli_query($con,”DELETE FROM user where FirstName=’jay'”); // Delete data from table

mysqli_close($con); // Close database connection

Leave a Reply

Your email address will not be published. Required fields are marked *