Insert and Display Data in PHP & MYSQL Without Refreshening Page


This tutorial is all about Insert and Display Data in PHP & MYSQL Without Refreshening Page. In this tutorial you will learn Insert and Display Data in PHP & MYSQL Without Refreshening Page.

Good Day! Everyone! Today I’m going to teach you my inserting and displaying data in your database. Unlike with my previous tutorial which is about a very simple way in inserting and showing data in database. Here, you don’t need to refresh your page in order to display the inserted data and we add some styles now.

So before you go with this tutorial, for the beginners, I suggest to start with my previous tutorial regarding simple way of inserting and displaying data in PHP. >> click here << to go my previous article.

So now, we will going to start our tutorial.

Make sure you already have the following. You can download it below:




Now, if you are already done downloading all the files below. Just go now to your browser then go to PHPMYADMIN to create a database.

Create a database then name it as any name you desire. In my case, I use “itsourcecode” as the name of the database.

Then create a table. Put “mydata” as the table name then put the following attributes.

Now for the connection to the database. Create a “connection.php” file then put the following codes.

$servername = ‘localhost’;
$username = ‘root’;
$password = ”;
$dbname = ‘itsourcecode’;

try {
$conn = new PDO(“mysql:host=$servername;dbname=$dbname”, $username, $password);
} catch (Exception $ex) {
echo “Connection Failed: “. $ex->getMessage();

As you can see, we now upgraded our coding structure in managing our database using PDO. This is now the updated version in MYSQL.

Now, create a “index.php” file then put the following codes.

<!DOCTYPE html>
<meta charset=”UTF-8″>
<meta name=”viewport” content=”width=device-width, initial-scale=1″>
<title>Inserting Data Without Refreshing the Page</title>
<link href=”assets/css/bootstrap.min.css” rel=”stylesheet” type=”text/css”/>

Inserting Data in PHP/MYSQL Without Refreshing the Page




<!– Start Add Data Modal –>

Looking for more source code? Type your keyword here here!



Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.