PHP MySQL Select Data

Select data from MySQL database in PHP

In PHP web application we wish to select data from MySQL database then first establish connection between PHP web application and MySQL database. After establish a connection use SELECT statement to select data from MySQL database.

SELECT Statement

The SELECT statement is used to select data from a table  in the database.

SELECT Statement Syntax

The SELECT Syntax categorize in to two parts , first we retrieve all columns means full table data, second we retrieve some specific columns from a table.

Select all columns from table

SELECT * FROM table_name

Select some columns data from a table

SELECT col1, col2, col3 FROM table_name


PHP Example of Select data from database

The result  of above PHP MySQL example :

php-mysql example

PHP MySQL Connection Example using MYSQLi Extension

Leave a Reply

Your email address will not be published. Required fields are marked *

6 + 2 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">