How to display data from a database in PHP
In this tutorial, you will learn how to display data from a database in PHP. This is a very common feature and is required in any kind of web application. I will explain in detail from scratch. In order to get the table data from MySQL, we will use PHP code to retrieve data from MySQL database and display the result on our browser.
Also read, How to insert HTML form data in Mysql database using PHP
Steps to display data from database in PHP
Step 1:- Click on new at the left sidebar inside the phpMyAdmin.
Step 2:- Create a database in PHPMyAdmin as shown in the below screenshot.
Step 3:- Create a table in the database you created as shown in the below screenshot.
DDL information of the table CREATE TABLE student_info (
…
id int(10) NOT NULL AUTO_INCREMENT,
name varchar(255) DEFAULT NULL,
age int(20) NOT NULL,
phone_no varchar(20) NOT NULL,
created_at timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
updated_at timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY (id)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT