How to Fetch Data From Database and Show the Data in the HTML Table Using PHP
This tutorial will teach you the step-by-step process of how to fetch the MySQL table and show records in the HTML using PHP. Create a Database and Table in MySQL First, we will create a "demo" database and a "products" table. You can use either PHPMyAdmin MySQL or SQLyog to execute the following SQL query: MySQL Query: /*Your SQL queries*/ CREATE DATABASE demo; /*phpmyadmin MySQL Database Query*/ /*or*/ CREATE DATABASE demo; /*SQLyog Database Query*/ USE demo; /*Table structure*/ DROP TABLE IF EXISTS `products`; CREATE TABLE `products` ( `id` int(11) NOT NULL, `Manufacturer` char(60) DEFAULT NULL, `Module` char(60) DEFAULT NULL, `Series` char(60) DEFAULT NULL, `MPN` char(60) DEFAULT NULL, `Function` char(60) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; /*Data for the table*/ insert into `products`(`id`,`Manufacturer`,`Module`,`Series`,`MPN`,`Function`) values (1,'Microsoft','Operation System','A','1263187','OS'), (2,'Amazon','Web Services','B','3473747','Web'), (3,'Rockwell Automation','Electronic Modules','C','9854747','Machine Control'), (4,'Facebook','Social Connectivity','D','1271517','Social'), (5,'Google','Search Engine','E','6372673','Search'); To import these records, you can copy this query and run it directly in PHPMyAdmin MySQL or SQLyog.