It is quite simple
$db = new mysqli("host", "user", "password", "db");
$result = $db->query("SELECT * FROM $tableName");
while ($row = $result->fetch_row()) {
//etc.
}
I find the php.net documentation on mysqli useful for looking up functions as well as codesnippets. This also answers your question php.net/mysqli_fetch_row