Php display data from database in table
- select mysql in php
- select mysql php pdo
- select mysql phpmyadmin
- mysql_select_db in php
Php mysql where multiple conditions.
How to retrieve data from MySQL database using PHP ?
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.
Php select query
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.
XAMPP PANEL
After that create the database in the PHPMyAdmin.
Open the below URL.
http://localhost/phpmyadmin/index.phpCreating the database:
creating the database in MySQL PHPMyAdmin
Create the table: Execute the SQL query in the “gfg” database.
CREATE TABLE student ( name varchar(20), branch varchar(20), roll_no INT );Enter the data in the table.
INSERT INTO `student` ( `name`, `branch`, `roll_no`) VALUES ( 'Rohan', 'CSE', '1' );After the data is inserted, the table will look like this.
After entering the data in the table
PHP Code: Run the PHP script as shown below to fetch the data from the database.
PHP
|