How to Display Certain Fields of a Table in MySQL Using PHP


In this article, we show how to display certain fields of a table in MySQL using PHP.

Say, for example, a table has many different fields, for example, a user's first name, last name, email address, address, city, state, zip code, telephone number. However, all we want to show is the user's first name, last name, and email address, and not display any of the other columns.

Using PHP, we can selectively decide which columns of a table we want to display.

An example is below:

In the below table, we show the images column, containing the image of the chips, the Type column containing the type of chips it is, and the Price column containing the price of the chips.