A simple example of connecting to and querying a MySQL database using PHP. There is no error checking!

5 rows returned for query SELECT * FROM jiltest ORDER BY last_name.

 

Here's a table-oriented presentation of the data.
idlast_namefirst_namephone
4AbleMable111-566-6612
3DoeJohn555-658-9988
5DoeJane555-222-4321
2JonesQuincy222-555-1234
1SmithJohn555-258-3652

 

Here's a line-oriented presentation.
Able, Mable 111-566-6612
Doe, John 555-658-9988
Doe, Jane 555-222-4321
Jones, Quincy 222-555-1234
Smith, John 555-258-3652

This code does not adhere to best practices!

Everyone should read and learn the mysql_XXXXX function docs at php.net.

Never allow input fields from a form to be passed to a query without taking the proper steps to defeat SQL insertion hacks! If you don't know how to do that, hit the web!