number of rows in a table

后端 未结 3 385
南笙
南笙 2020-12-10 21:01
 

        
3条回答
  •  醉梦人生
    2020-12-10 21:17

    $query = "SELECT COUNT(*) FROM accounts";
    $result = mysqli_query($mysqli,$query);
    $rows = mysqli_fetch_row($result);
    echo $rows[0];
    

    or

    $query = "SELECT COUNT(*) AS SUM FROM accounts";
    $result = mysqli_query($mysqli,$query);
    $rows = mysqli_fetch_assoc($result);
    echo $rows['SUM'];
    

提交回复
热议问题