Warning: mysqli_fetch_array and mysqli_num_rows

Hi guys and thank you for your help.

Warnings:

  • Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, bool given in /home/tuttoco1/prova.it/login.php on line 22

  • Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in /home/tuttoco1/prova.it/login.php on line 27

  • Line 22 : while ($sezione=mysqli_fetch_array($ris5))

  • Line 27 : $count=mysqli_num_rows($ris5);

<?php
session_start();   ?>
 <body bgcolor="black" color=white>
 <center> <font color="white" size=20>  <br> <br><br> <?php
include("config.php");
if(isset($_SESSION['password2']))
{

       
          print("<script> location.replace('index3.php'); </script>"); exit();   
          } else {       
  
   
$mypassword=$_POST['Password'];
$nome=$_POST['Nome'];   
$cognome=$_POST['Cognome'];


$sql5="SELECT * FROM config WHERE Password='$mypassword' and Nome='$nome' and Cognome='$cognome'";
$ris5=mysqli_query($conn,$sql5); 
 
  while ($sezione=mysqli_fetch_array($ris5))
  {
  $co=$sezione['Tipo'];
   $CCA=$sezione['Codice'];   }
   
$count=mysqli_num_rows($ris5);
    if($count==0)
     { 
       print("DATI ERRATI.");
       print("<br><a href=\"index3.php\">Riprova.</a><BR> ");
       
     }
         else             
         {
                                        $_SESSION['nome']=$nome;
                                           $_SESSION['cognome']=$cognome;
                                         $_SESSION['liv']=$co;
                                         $_SESSION['password2']=$mypassword;
                                         $_SESSION['codice']=$CCA;
                                            
                                  
                                 
                                       print("<script>location.replace('index.php'); </script>");
                                        }
                                 
                     

?> 
<BR>           
<?php } ?>
</body>
</html>