<?php
/**
 * Created by PhpStorm.
 * User: sunusi
 * Date: 2019-01-21
 * Time: 07:19
 */

include "db.class.php";
$qry = new db();

/*
$User = $qry->getOne('SELECT * FROM bits_clients '); // 1 line selection, return 1 line
echo $User['client_id'].'<br>'; // display the id
echo $User['client_name'].'<br>'; // display the first name
echo $User['client_address']; // display the last name */

$Users = $qry->getAll('SELECT bits_lga.*, bits_states.* FROM bits_lga JOIN bits_states ON bits_states.state_id = bits_lga.state_id'); // select ALL from users

$nbrUsers = count($Users); // return the number of lines

echo $nbrUsers . ' users in the database<br />';


print("<table width='300'><thead><tr><td>LGA</td><td>STATE NAME</td></tr></thead>");
foreach ($Users as $user) { // display the list
    echo "<tr><td>" . $user['lga_name'] . "</td><td> " . $user['state_name'] . "</td></tr>";
}
print("</table>");
