1
I’m making a site where several users can log in. I logged in for the login but I can’t find the other user data that is in the database. How can I do this?
have the function
$usuario = buscaUsuario($conexao, $_POST['email'], $_POST['senha']);
if($usuario == null) {
header("Location: ../index.php?login==0");
} else {
logaUsuario($usuario['nome']);
header("Location: ../interno/index.php");
}
die();
and I also have:
function buscaUsuario($conexao, $email, $senha) {
$query = "select * from usuarios where email='{$email}' and senha='{$senha}'";
$resultado = mysqli_query($conexao, $query);
$usuario = mysqli_fetch_assoc($resultado);
return $usuario;
}
on the line logaUsuario($usuario['nome']);
if I change name to email or any other bank data it changes there in my username.... but I can’t multiply the log($user['name']); to fill the data in the user profile page
It depends on what your database looks like. Edit the question and add the code you tried to do.
– Woss
It also depends on what you’re saving in this session.
– bfavaretto
Just one question before displaying the code. I can store all the data that is in the user database in a session?
– Francis Vagner da Luz
try to post code so we can help
– 13dev
@Francisvagnerdaluz Yes, but it’s not the right thing to do.
– Francisco
have function $user = searchUsuario($connection, $_POST['email'], $_POST['password']); if($user == null) { header("Location: ../index.php?login==0"); } Else { logaUsuario($user['name']); header("Location: ../internal/index.php"); } die();
– Francis Vagner da Luz
mas não consigo multiplicar o logaUsuario($usuario['nome']); para preencher os dados na página de perfil do usuário
Multiply as well ?– 13dev
What is the code for the login function? If you can, please edit the question again by informing it helps us.
– Grupo CDS Informática