php执行mysql语句
php执行mysql语句
//定义sql语句 $sql = "SELECT * FROM tablename"; //执行结果 //$link=mysqli_connect($db_host, $db_user, $db_pass)连接数据库成功后 $result = mysqli_query($link, $sql); //结果导入到数组中 //MYSQLI_ASSOC为常量 $arrs = mysqli_fetch_all($result, MYSQLI_ASSOC) //获取记录数目 $records = mysqli_num_rows($result);