I have the database and web server on separate machines, an array from a mysql query is passed to the web server and looks like so
Array (
[user_id] => 1
[username] => phillip
[password] => 12345
[email] => [email protected]
[account_balance] => 100 )
If I print out this array in PHP using print_r($myArray); it shows in the web browser like so
Array ( [user_id] => 1 [username] => phillip [password] => 12345 [email] => [email protected] [account_balance] => 100 )
I want to create PHP code that will iterate this array and make columns for user_id, username, password, email, and account_balance and then display the results in rows.
Here is my PHP code in a file display.php
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Page</title>
</head>
<body>
<table border="1">
<?php
include(fileThatCallsDBServer.php);
$myArray = getMYSQLArray(); //This calls a function located in the file in the include() and returns array
print_r($myArray); //print the array for testing purposes
//Create table to display array
$html = "<table>";
foreach($myArray as $row) {
$html .= "<tr>";
foreach ($row as $cell) {
$html .= "<td>" . $cell . "</td>";
}
$html .= "</tr>";
}
$html .= "</table>";
?>
</body>
</html>
However, nothing gets displayed when I look at the page on my browser. Ideas?