Often in PHP you want the same block of code to run over and over again and instead of adding several almost equal lines, you can use loops to perform this task much easier.
If you want to start learning PHP and MySql, the first step is to setup complete environment on your local computer. This will include Apache web server with PHP support and MySql database server.