I've been working on a recent assignment and have come to a standstill as I cannot figure out the issue causing my code to not render to the webpage. I'm using html with a php script inside. Since I'm new to php it is difficult for me to debug my code properly. Tips are welcomed. The goal of my assignment is to link up with a database that I have access to and to display a table from it in table format. Here's what I currently have and thanks for any assistance!
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Project 3</title>
</head>
<body>
<?php
/*config is included in order to protect my login info*/
require('config.php');
/*SQL connection*/
$conn = new mysqli(DB_HOST,DB_USER,DB_PASS,DB_NAME);
/*Checking Connection*/
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
echo "you have connected";
$sql = "SELECT * FROM studentInfo";
$data1 = mysqli_query($conn, $sql);
/*Display Data*/
echo "<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
</tr>";
while($records = mysqli_fetch_array($data1)){
echo "<tr>";
echo "<td>" . $records["FirstName"] . "</td>";
echo "<td>" . $records["LastName"] . "</td>";
echo "</tr>";
echo "<br />";
}
echo "</table>";
mysqli_close($conn);
?>
</body>
</html>