<?php
$username = $_SESSION['username'];
$db = new PDO('mysql: host=localhost;dbname=menusp;','***','***');
$stmt = $db->prepare("SELECT id, shopName, shopType FROM shops WHERE username = :username");
$stmt->bindValue(':username', $username);
$stmt->execute();
$data = $stmt->fetchAll();
?>
<div class="shop-flex">
<?php
if($stmt->rowCount() == 0){
echo "Add your first location to get started";
}else{
foreach ($data as $row) { ?>
<div class="shop-locations">
<a href="view-shop.php?id=<?php echo $row['id']; ?>&type=<?php echo $row['shopType'][0]; ?>"><?php echo $row['shopName']; ?></a>
</div>
<?php
}
}
?>
</div>
</div>
I'm trying to get shopType to show the full name selected from my database but it's only showing my the first letter, without [0] it comes up as array