Skip to content

php获取数据库前10条记录

<?php header("Content-type: text/html; charset=utf-8"); include('./config.php'); $sql = "SELECT id, shuoshuo FROM shuoshuo "; $result = mysqli\_query($conn, $sql); $data= mysqli\_fetch\_all($result); for ($a=0;$a<10;$a++) { echo $data\["$a"\]\[0\].$data\["$a"\]\[1\]; } ?>