![]() |
VOOZH | about |
There are steps to understand for retrieving the data from the MySQL database.
Approach:
Now we understand each and every step as shown below.
Example 1: In this. we use PHPMyAdmin for the database handling. Start the server in the XAMPP as shown in the below image
Making sure that both Apache and MySQL are showing green color, means that the server is working.
After that create the database in the PHPMyAdmin. Open the below URL.
http://localhost/phpmyadmin/index.php
Create the table: Execute the SQL query in the "gfg" database.
CREATE TABLE student ( name varchar(20), branch varchar(20), roll_no INT );
INSERT INTO `student` ( `name`, `branch`, `roll_no`) VALUES ( 'Rohan', 'CSE', '1' );
After the data is inserted, the table will look like this.
PHP Code: Run the PHP script as shown below to fetch the data from the database.
Output: