Displaying records from sample tables using SELECT query in PHP MySQL using PDO functions

preview_player
Показать описание

How to enable PDO support and install sample script

In previous tutorials we discussed about connecting to MySQL database. Here we will use the same connection to collect records from our sample student table and display each record.
First we will create the simple SELECT query to get all columns of out student table.
$sql="SELECT * FROM student ";
Using this we will collect records from the table by using query() and using foreach loop to display all records.
WE can change the query and add different conditions like WHERE class=’Three’ or display records in the order of mark staring from highest to lowest or from lowest to highest.
Рекомендации по теме
welcome to shbcf.ru