Good morning, someone help me? I do not understand much of php, but for me to finish my site there is only one thing: I need to post the sum of the values that are in the table but based on the logged in user, already tried in all the ways but I can not follow the last one that 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 have tried everything or even just get values from the column without being a user logged in. The page is completely blank.