My goal is to populate my HTML table with SQL results that I pull from the below PHP code that I have written. Keep in mind that in reality my hostname, username and password variables do have string data in them. The first block is my PHP where I am retrieving my selected data. The second part is where I am trying to populate my HTML table. Unfortunately, I am not seeing any data.
<html lang="en">
<?php
$hostname = "";
$username = "";
$password = "";
$databaseName = "MainDatabase"
$mysqli = new mysqli($hostname, $username, $password);
if ($mysqli) {
$mysql_select_db($databaseName);
$result = mysql_query("SELECT ID, User_FirstName, User_LastName, User_Email, UserName, UserPassword FROM Users");
if ($row = mysql_fetch_array($result) {
if ($query_row = mysql_fetch_assoc($row) {
$id = $query_row['ID'];
$user_lastname = $query_row['User_LastName'];
$user_firstname = $query_row['User_FirstName'];
$user_email = $query_row['User_Email'];
$username = $query_row['UserName'];
$userpassword = $query_row['UserPassword'];
} else {
echo "** Error **";
}
} else {
echo "** Error **";
}
} else {
echo "Unable to create connection .. !";
}
?>
<h2 class="sub-header">Current Registered Users</h2>
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>User ID</th>
<th>First Name</th>
<th>Last Name</th>
<th>Primary Email</th>
<th>Username</th>
<th>Password</th>
</tr>
</thead>
<tbody>
<tr>
<td> <?php echo "$id"; ?> </td>
<td> <?php echo "$user_firstname"; ?> </td>
<td> <?php echo "$user_lastname"; ?> </td>
<td> <?php echo "$user_email"; ?> </td>
<td> <?php echo "$username"; ?> </td>
<td> <?php echo "$userpassword"; ?> </td>
</tr>
</tbody>
</table>
</div>