As the title states, I am only able to grab the id column, I am getting an Undefined index error for the others.
My code:
if(isset($_SESSION['id'])) {
$presh = $_SESSION['id'];
$stmt = $pdo->prepare("SELECT id FROM users WHERE id = :id");
$id = $presh;
$stmt->execute(array(':id'=>$id));
$accountinfo = $stmt->fetch(PDO::FETCH_ASSOC);
}
Later on in my code I reference it as such:
Karma <span id="kcurrent"><?php echo $accountinfo["karmacurrent"]; ?></span> | <span id="ktotal"><?php echo $accountinfo["karmatotal"]; ?></span>
The rows do exist and they are filled, what am I doing wrong?