PHP Warning: mysqli_fetch_assoc() expects exactly 1 parameter, 3 given in

前端 未结 2 1159
难免孤独
难免孤独 2021-01-15 18:47

I get this error, I tried going through other similar threads but it didn\'t help.

here is php

$host = \"http://www.domain.com\";
$hostname = \"local         


        
相关标签:
2条回答
  • 2021-01-15 19:19

    Syntax mysqli_fetch_assoc is:

    array mysqli_fetch_assoc ( mysqli_result $result )
    

    Try (for PHP >=5.4):

    $hits = mysqli_fetch_assoc($result)['hits'];
    
    0 讨论(0)
  • 2021-01-15 19:34

    From the codes, I see that you want to UPDATE the final records from hits.

    $hitquery =  "SELECT * FROM $userstable where url = '$url'";
    $result = mysqli_query($con, $hitquery);
    while(null !== ($hits= mysqli_fetch_assoc($result))) {
        $query2 = "UPDATE $userstable SET `hits` = hits+1 where url = '$url'";
    }
    
    0 讨论(0)
提交回复
热议问题