I am trying to build a table using in PHP with some text coming from mysql database:
However, when I echo the table, the page comes up as blank
Here's my code
<!DOCTYPE html>
<html lang="en">
<title>Pre Order</title>
</head>
<body>
<div class="page">
<?php
include_once "connect.php";
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$conn2 = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
$form=$_POST;
$a=$form['a'];
$b=$form['b'];
$c=$form['c'];
$accountnumber=$form['accountnumber']
$stmt = $conn->query("SELECT * FROM Contracts WHERE A='$a' AND B='$b' AND C='$c'");
$stmt2 = $conn2->query("SELECT * FROM Customers WHERE CustomerCode='$accountnumber'");
$data = '';
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
while ($row2 = $stmt2->fetch(PDO::FETCH_ASSOC)) {
$data .= "<table>";
$data .= "<tr><td>Account Number: </td>";
echo $data;
}
}
?>
</div>
</body>
</html>
However, when I remove the mysql connection, the echo works fine.
The file is a .php file.