I'm trying to show data that the user has connected, but I can not. What I want to show is the text of the alert that that connected user has. As you see and done a print_r
and I get SELECT alerta FROM usuarios WHERE usuario='[email protected]'
, the user I have assigned to the user email. I get the connected user, but does not return that user's alert.
This is the SOLUTION, NO ONE thought about what I said that the user of the session was linked to the email:
<?php session_start();
include_once '../pruebas/conexion.php';
if (!isset ($_SESSION['usuario'])){
header('Location: ../login.php');
};
$sql_leer = "SELECT alerta FROM usuarios WHERE email='".$_SESSION['usuario']."'";
$gsnet = $pdo->prepare($sql_leer);
$gsnet->execute();
$resultado = $gsnet->fetchAll();
?>
<div class="alert alert-danger" role="alert">
<?php echo $resultado?>
</div>