1
I have a question about login for several people. I have this code:
<?php
include("conectar.php");
$usuario = $_POST['usuario'];
$senha = $_POST['senha'];
$query = "
SELECT count(*)
FROM usuarios
WHERE usuario = '" . $usuario . "' AND senha = '" . $senha . "'";
$consulta = mysql_query($query);
$resultado = mysql_fetch_array($consulta);
if ($resultado[0]) {
echo "Login realizado com sucesso!";
}
else {
echo "Dados incorretos.";
}
?>
Each Login will have a specific data to display from a table tb_company. When logging in, I need to show this worker’s data. I know that it is necessary to do a query for each user. If login is done by Y, do query Y and display data Y. If login is done by Z, do query Z and display data Z. But I don’t know how to do this.
This same data is found in a Mysql database. The only data that can be related is the ID_empresa
and ID_usuario
.
Does the answer solve your problem? If yes, mark it as right.
– Jorge B.
Calm down, Jorge :)
– bfavaretto