I'm trying to do a simple login and I found this code that uses MySQL for that, but my website uses mysqli
I tried to change it myself but crashes the website, is there a mysqli equivalent for this piece of code?
What I want to change
$result=mysql_query($sql);
if(mysql_num_rows($result)==1){
echo " You Have Successfully Logged in";
header("location: menu.html");
}
else{
echo " You Have Entered Incorrect Password";
exit();
}
I don't know if this helps, but here is what I have before that piece of code
$server = I;
$usuario = WONT;
$pass = SHOW;
$database= THIS;
$mysqli = new mysqli($server, $usuario, $pass, $database);
echo "estoy aqui";
$uname=$_POST['usuario'];
$password=$_POST['password'];
$sql = $mysqli -> query ("select * from USUARIOS where usuario='".$uname."'AND password='".$password."' limit 1");
$result=mysql_query($sql);