Kmspico Download | Official KMS Activator Website [New Version 2024] Fast and Easy Converter YouTube to MP3 Online KMSAuto Net Activator Download 2024 Immediate Byte Pro Neoprofit AI Blacksprut without borders. Discover new shopping opportunities here where each link is an entrance to a world ruled by anonymity and freedom.

How to insert data into database table in php language?

Inserting Data into a MySQL Database Table

Now that you’ve understood how to create database and tables in MySQL. In this tutorial you will learn how to execute SQL query to insert records into a table.
The INSERT INTO statement is used to insert new rows in a database table.
Let’s make a SQL query using the INSERT INTO statement with appropriate values, after that we will execute this insert query through passing it to the PHP mysqli_query() function to insert data in table. Here’s an example, which insert a new row to the data table by specifying values for the title and content fields.


Step 1 :- First create database table

 `id` int(100) NOT NULL,
 `title` varchar(100) NOT NULL,
 `content` varchar(100) NOT NULL

Step 2:-Then Create db connection in php and mysqli with insert query in index.php file


<link href="css/bootstrap.min.css" rel="stylesheet">
<form method="post" action="">
 <div class="container">
 <h1 class="well">insert data</h1>
 <div class="col-lg-12 well">
 <div class="row">
 <div class="col-sm-12">
 <div class="row">
 <div class="col-sm-6 form-group">
 <input type="text" name="title" id="name">
 <div class="col-sm-6 form-group">
 <textarea name="content" class="form-control"></textarea>
 <button type="submit" name="Register" value="Register" class="btn btn-primary btn-block">Register</button> 
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "register";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
 die("Connection failed: " . mysqli_connect_error());
 $sql1 = "INSERT INTO data(title, content) VALUES ('$title', '$content')";
 if(mysqli_query($conn, $sql1)){ 
 echo "New record created successfully";