0
Good morning, everyone, help me? i do not understand much of php, but for me to finish my site missing only one thing: I need to post the sum of the values that are in the table but based on the logged in user, I already tried all the ways but I can not follow the last one I tested:
<?php
$_SESSION['usuario'] = 'user_login';
$sql = $pdo->prepare("SELECT SUM(valor) AS total FROM investimentos WHERE usuario= usuario");
//Passa o ID do usuário para a query
$sql->bindValue(1, $_SESSION['user_login'], PDO::PARAM_INT);
$sql->execute();
$ln = $sql->fetchObject();
echo $ln->total;
?>
I’ve tried everything or take only column values without being logged in with you page is all blank.
Voce ta creating a session variable as a string 'user_login'..
– Luís Almeida