3
Good,
I have a question in the code I’m doing. I want normal users to see one page but if it’s login admin, it will end up on another page .
$login = mysql_query("SELECT Nome, Password FROM tb_utilizador WHERE Nome = '$Nome' AND Password = '$Password'");
$loginadm = mysql_query("SELECT Nome, Password FROM tb_utilizador WHERE Nome = 'ADMIN' AND Password = 'AdminAdmin'");
$res = mysql_fetch_row($login);
$resadm = mysql_fetch_row($login);
if($res)
{
header('location:compras.html');
}
else
{
echo "<p>Utilizador ou password invalidos. <a href=\"index.html\">Tente novamente</a></p>";
}
if($resadm)
{
header('location:comprasADM.html');
}
else if ($loginAdm)
{
echo "<p>Utilizador ou password invalidos. <a href=\"index.html\">Tente novamente</a></p>";
}
$resadm = mysql_fetch_row($login);
this shouldn’t be$resadm = mysql_fetch_row($loginadm);
?– MoshMage
Excuse my English. You should be aware that the function
mysql_*
is obsolete. Y is no longer used in PHP7.. You should be using the functions.mysqli_*
or PDO (PHP Data Objects).– André Ferraz