Insert Records
We will now insert some records into our table. Here we are inserting 4 records. You can add multiple records.
Copy and paste the following code into the SQL panel to insert records into the table.
INSERT INTO `user_info` (`first_name`, `last_name`, `gfg_username`) VALUES ('Rohit', 'Kumar', 'rohitk987'),
('Nisha', 'Jadhav', 'nishajadhav001'), ('Aayush', 'Joshi', 'geeky1aayush'), ('Shweta', 'Pawar', 'shwetap12gfg');
PHP program to fetch data from localhost server database using XAMPP
In this article, we will see how we can display the records by fetching them from the MySQL database using PHP.
Approach: Make sure you have an XAMPP server or WAMP server installed on your machine. In this article, we will be using the XAMPP server.
XAMPP is a free and open-source cross-platform web server solution stack package developed by Apache which allows a web application to be easily tested on a local web server. Here, we can manually create a relational database and store data in tabular form by going to this link. But to operate on localhost or for storing data first we have to start Apache and MySQL from the XAMPP control panel. Let, for example, the database name is server, the table name is user_info having column names as ID, First Name, Username, and Password and we have to fetch the data stored there. So, below is the PHP program whose task is to fetch data.
Follow the steps to fetch data from the Database using PHP:
Table of Content
- Create Database
- Create Table
- Insert Records
- Creating folder and files