I'm about to pull my hair out. I can't get the undefined index to go away. Basically where it says echo htmlspecialchars($r['serial'])
I want it to list the item out of the database table.
<?php
try{
$conn = new PDO("mysql:host=$sql_server;dbname=$sql_db", $sql_user, $sql_pass);
$sql = "SELECT serial, model, deviceCondition, sealCondition, location, deployDate, weight, notes FROM $sql_table ORDER BY serial";
$q = $conn->prepare($sql);
$q->setFetchMode(PDO::FETCH_OBJ);
while ($r = $q->fetch());
} catch (PDOEException $pe) {
die("Could not connect to the database" . $pe->getMessage());
}
?>
</div>
<?php
$r = $q->fetchAll();
echo htmlspecialchars($r['serial'])
?>