不明白为什么不这样做

时间:2019-03-14 12:29:39

标签: php mysqli

我是php的菜鸟:)

我需要一些帮助,我不明白为什么会出现此错误->

  

致命错误:在[...]的null上调用成员函数query()   第47

这是我的代码:

<?php
include("auth.php"); ?>
<!DOCTYPE html>
<html>
  <head>
  <meta charset="utf-8">
    <title>Statistiche</title>
    <link rel="stylesheet" href="css/style.css" />
  </head>
  <body style="background-color:#F1F1F1;color:dimgray">
    <center>
<div style="width:80%;background-color:#F1F1F1;font-size:100%;" align="center">
  <table style="text-align:center;width:100%" cellpadding="4" cellspacing="0">
    <tr style="height:80px">
    <td style="width:20%"></td>
    <td style="width:60%"><img src="logo/fsmlogo.gif" align="center" width="30%" alt="FSM"></td>
    <td style="width:20%">
    <div class="form">
      <p>Benvenuto <?php echo $_SESSION['utente']; ?></p>
      <p><br /></p>
      <a href="logout.php">Logout</a>
    </div>
  </td></tr></table>
<br /><br />
<div style="background-color:#0067ab">
<br>
<b style="color:white;font-size:140%">FUNZIONI STATISTICHE</b><br>
<b style="font-size:90%;color:white"><i>- Clicca sulle caselle per esplorare le funzioni del sito -</i></b><br>
<br>
<table style="text-align:center;width:100%" cellpadding="4" cellspacing="1">
  <tr style="height:40px">
    <td style="width:7%"></td>
    <td style="width:24%; background-color:#F1F1F1; border: 1px solid black; font-size:1.5em"><b><a href="rose.php"><img src="logo/rose.png" width="70%" alt="Rose"></a></b></td>
    <td style="width:7%"></td>
    <td style="width:24%; background-color:#F1F1F1; border: 1px solid black; font-size:1.5em"><b><a href="classifiche.php"><img src="logo/classifiche.png" width="70%" alt="Classifiche"></a></b></td>
    <td style="width:7%"></td>
    <td style="width:24%; background-color:#F1F1F1; border: 1px solid black; font-size:1.5em"><b><a href="risultati.php"><img src="logo/risultati.png" width="70%" alt="Risultati"></a></b></td>
    <td style="width:7%"></td>
  </tr>
</table><br />
    <table style="text-align:right;width:100%" cellpadding="4" cellspacing="1">
        <tr style="height:40px"><td style="width:7%"><a href="index.php"><img src="logo/indietro.png" width="5%" alt="Indietro"></a></td></tr>
    </table>
</div>
<?php
     $query = "SELECT user, password FROM login";
     $result = $mysqli->query($query);
     $row = $result->fetch_array(MYSQLI_NUM);
     print_r($row);
     while($row = $result->fetch_array(MYSQLI_NUM)){
    print_r($row);
     }
?>
    </center>
  </body>
</html>

请,您能帮我吗?我不明白为什么会有这个错误:(

谢谢

毛罗

0 个答案:

没有答案