这个报错是不是数据库的问题?求大佬解答下,谢谢!
<?php
$con = mysqli_connect(
'localhost', /* The host to connect to 连接MySQL地址 */
'root', /* The user to connect as 连接MySQL用户名 */
'root', /* The password to use 连接MySQL密码 */
'wechat'); /* The default database to query 连接数据库名称*/
$sql = "SELECT * FROM abc";
$result = mysqli_query($con, $sql);
//将数据给弄出来
if (mysqli_num_rows($result) > 0){
$data = array();
while ($row = mysqli_fetch_assoc($result)) {
$data[] = $row;
}
//随机个数,默认1
$rand_times = 1;
$rand_times = count($data)<$rand_times?count($data):$rand_times;
$ress = array();
for( $i=0;$i<$rand_times;$i++ ){
$ress[] = $data[rand(0,count($data)-1)][0];
echo $ress;
}
}
?>
慕村9548890
慕的地10843
偶然的你