How to loop through a mysql result set

database, mysql, php

Solution

Here is a full example:

http://php.net/manual/en/mysqli-result.fetch-array.php

- Connect

- Select database

- Make query

- Cycle on the result and fetch array to get the row

Problem

What are some different ways to loop through a mysql result set? I'm new to PHP and MySQL so I'm looking for simple ways to loop through and an explanation as to how the provided code works.

Original source