Using PHP and MySQL to create dynamic, database-driven Web sites is a breeze. Just remember that the PHP functions are essentially a gateway to the database server; anything you'd enter using the MySQL command-line interface, you can use with the mysql_query() function.
To connect to MySQL with PHP, you need to know your MySQL username, password, and database name. Using the mysql_connect() and mysql_select_db() functions, you can connect to and select a database to use throughout the life of the script.
Once connected, you can issue standard SQL commands with the mysql_query() function. If you have issued a SELECT command, you can use mysql_num_rows() to count the records returned in the result set. If you want to display the data found, you can use mysql_fetch_array() to get all the results during a loop and display them onscreen.