2
In my PHP code appear the following "warnings":
Warning: mysqli_query() expects Parameter 2 to be string, Object Given in line 8
Warning: mysqli_num_rows() expects Parameter 1 to be mysqli_result, null Given in online 9
I honestly do not understand what this means in practice, what is parameter 2? I do not understand very well when these warnigns appear to me.
Follows the PHP code:
<?php
include("config.php");
if($_GET['key'] && $_GET['reset'])
{
$email=password_hash($_GET['key'],PASSWORD_DEFAULT);
$pass=password_hash($_GET['reset'],PASSWORD_DEFAULT);
$sql=mysqli_query($conn,"SELECT email, password FROM registo where email='$email' and password='$pass'");
$r = mysqli_query($conn, $sql); // Linha 8
$count = mysqli_num_rows($r); // Linha 9
if(mysqli_num_rows($sql)==1)
{
?>
<html>
<form method="post" action="update_newpassword.php">
<input type="hidden" name="email" value="
<?php echo $email;?>">
<p>
Enter New password
</p>
<input type="password" name='password'>
<input type="submit" name="submit_password">
</form>
</html>
<?php
}
}
?>
Remove this
$r
and use the$sql
in themysqli_num_rows()
. You’re passing the return ofmysqli_query
to the secondmysqli_query
and not an SQL statement.– KillerJack