Object of class mysqli_result could not be converted to string return mysql average

前端 未结 3 632
难免孤独
难免孤独 2020-12-21 12:35

Can someone explain how I would output the result of the sql below? currently getting \'Object of class mysqli_result could not be converted to string\'.

$sq         


        
相关标签:
3条回答
  • 2020-12-21 12:58

    Use any of mysqli_fetch_*() functions (or in OOP style: $result->fetch_*()) to retrieve the results from the mysqli_results object ($results).

    See mysqli_result documentation on the various methods and their uses.

    0 讨论(0)
  • 2020-12-21 13:05

    because you try to use echo to print object, and it used to print string only, you should use:

    print_f($result);
    

    instead of

    echo ($result);
    
    0 讨论(0)
  • 2020-12-21 13:07

    Error because you are echoing an object, so try like this,

    while($res = mysqli_fetch_array( $result )) {
        echo $res['AverageSatisfactionScore'];
    } 
    
    0 讨论(0)
提交回复
热议问题