簡體   English   中英

PHP相同的代碼不返回值

[英]php same code not returning value

我的php代碼未正確執行,我正在呼應一個類別,並且它正在呼應完美,但是當我釋放變量時,我得到了錯誤,提示mysqli_free_result()期望參數1為mysqli_result,給出的null ...

<li><a href="#" > <?php while($result3 = mysqli_fetch_array($row2)){ 
echo $result3['category'] ; } ?> </a></li>
<?php mysqli_free_result($result3) ; ?>   

而且,下面的我的php代碼都不是exectuing,它只是不返回任何數據(頁面源不提供任何數據)

我在做什么錯?

代替

<?php mysqli_free_result($result3) ; ?>  

做這個

<?php mysqli_free_result($row2) ; ?>  

mysqli_result應該是用於存儲查詢的變量。 IE瀏覽器:

$result=mysqli_query($con,$sql);

你想

mysqli_free_result($result);

根據代碼的外觀,您應該釋放$ row2

從代碼中刪除多余的語句,並將其添加到循環中

<li><a href="#" > 
  <?php while($result3 = mysqli_fetch_array($row2)){ 
       echo $result3['category'] ; 
       mysqli_free_result($row2) ;
   } ?> </a></li>   

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM