Welcome to PHP programming,
The SELECT statement is used to select data from a database.
For selecting data from the database we are using an already existing table student from college database.
Select Data From a Database Table:
The SELECT statement is used to select data from a database.
Syntax:
SELECT column_name(s) FROM table_name;
The above syntax displays the records of the mentioned column name only.
To display the records of all the columns of the table we use the below syntax:
SELECT * FROM table_name;
The WHERE clause
The WHERE clause is used to filter records. It is used to extract only those records that fulfill
a specified criterion.
Syntax:
SELECT column_name(s) FROM table_name WHERE column_name operator value;
ORDER BY keyword
The ORDER BY keyword is used to sort the data in a record set. It sort the records in ascending
order by default. To sort records in descending order, use the keyword DESC.
Syntax:
SELECT column_name(s) FROM table_name ORDER BY column_name(s) ASC/DESC;
To get PHP to execute the statement above we use the mysqli_query() function.
This function is used to send a query or a command to a MySQL connection.
Let us write a PHP code to display records of the table student using the WHERE clause the class BBM.
Save it in our server i.e., xampp/htdocs
Run the code using the url http://localhost/select.php
Let us write a PHP codde to display all records of the table student in descending order of student_id
Save it in our server i.e., xampp/htdocs
Run the code using the url http://localhost/select1.php
This is how select statement works with PHP script.
Thank You..................
For source code kindly refer www.studentprojects.live
Do you have Any queries? Contact us in Whatsapp :- +91-9972853368
#studentprojects #phpcode
In questa pagina del sito puoi guardare il video online PHP MySQL Select statement . della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Student Projects Live 15 marzo 2017, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 153 volte e gli è piaciuto 1 spettatori. Buona visione!