Im attempting to return a first name based off the users ID in a foreach statement but instead it returns the word "array" as the first name. I have no idea why its returning the word array in the scenario.
<table style="margin-top:-16px;">
<tbody style="overflow:hidden;">
<tr>
<th>Title</th>
<th>Author</th>
<th>Date Submitted</th>
<th>File Location</th>
<th>Download Status</th>
<th>Approve Status</th>
</tr>
<?php
$dbConnect = 'mysql:dbname=test;host=localhost';
$username = "test";
$password = "test";
try{
$dbConnect = new PDO($dbConnect, $username, $password);
} catch (PDOException $error) {
echo 'Error Connecting: ' . $error->getMessage();
}
$caseMgmtReturn = "SELECT * FROM `case`";
$caseMgmt = $dbConnect->query($caseMgmtReturn);
foreach ($caseMgmt as $row) {
$user = $row["userID"];
$firstPull = $dbConnect->prepare("SELECT `firstName` FROM `user` WHERE `userID`=:user");
$firstPull->bindValue(":user", $user);
$firstPull->execute();
$firstName = $firstPull->fetchAll(PDO::FETCH_ASSOC);
print "<tr> <td>" .$row["title"] . "</td> <td>" . $firstName . "</td> <td> " . $row["dateSubmitted"] . "</td> <td>" . $row["fileLocation"] . "</td> <td>" . $row["downloadStatus"] . "</td> <td>" . $row["approvedStatus"] ."</td></tr><br/>";
}
?>
</tbody>
</table>