Query Select From a Database

How to do a basic query from a MySQL database using PHP

1) Basic Query

SELECT * FROM table

2) Limit the Display of a Query

This displays only 10 rows of data

SELECT * FROM table LIMIT 10

This displays only 10 rows of data but starting from 0

SELECT * FROM table LIMIT 0,10

3) Order the Display of a Query

Alphanumerically order rows by a field using either Ascending (ASC) or Descending (DESC).

SELECT * FROM table ORDER BY field_id ASC

You may also like...

Leave a Reply