下面一起來了解下使用PHP mysqli_num_rows函數方法,相信大家看完肯定會受益匪淺,文字在精不在多,希望使用PHP mysqli_num_rows函數方法這篇短內容是你想要的。
mysqli_num_rows - 獲取結果中的行數
PHP4 | PHP5 | PHP7 |
---|---|---|
不支持 | 支持 | 支持 |
mysqli_num_rows ( mysqli_result $result )
返回結果集中的行數。 mysqli_num_rows的行為取決于是否使用緩沖的或未緩沖的結果集。 對于無緩沖的結果集,在檢索到結果中的所有行之前,mysqli_num_rows不會返回正確的行數。
參數 | 必需的 | 描述 |
---|---|---|
result | 是 | 由 mysqli_query(),mysqli_store_result() 或 mysqli_use_result() 返回的結果集標識。 |
返回結果集中的行數。如果行數大于PHP_INT_MAX,則該數字將作為字符串返回。
$link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } if ($result = mysqli_query($link, "SELECT Code, Name FROM Country ORDER BY Name")) { /* determine number of rows result set */ $row_cnt = mysqli_num_rows($result); printf("Result set has %d rows.\n", $row_cnt); /* close result set */ mysqli_free_result($result); } /* close connection */ mysqli_close($link);
看完使用PHP mysqli_num_rows函數方法這篇文章后,很多讀者朋友肯定會想要了解更多的相關內容,如需獲取更多的行業信息,可以關注我們的行業資訊欄目。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。