MYSQL_NUM 不能用在 mysqli_fetch_array上
如题, 加了 这个第二个参数,报错。
while($row=mysqli_fetch_array($res,MYSQL_NUM)){
print_r($row);
}
如题, 加了 这个第二个参数,报错。
while($row=mysqli_fetch_array($res,MYSQL_NUM)){
print_r($row);
}
2016-07-29
看看手册咯
mixed mysqli_fetch_array ( mysqli_result $result [, int $resulttype = MYSQLI_BOTH ] )
resulttype
This optional parameter is a constant indicating what type of array should be produced from the current row data. The possible values for this parameter are the constants MYSQLI_ASSOC , MYSQLI_NUM , or MYSQLI_BOTH .
用MYSQLI_NUM就行了
<?php
header("Content-type:text/html;charset=utf-8");
$host='localhost';
$user='g';
$password='yz';
$con = mysqli_connect($host, $user, $password);
mysqli_select_db($con, 'abc');
mysqli_query($con, "set names 'utf8'");
$res = mysqli_query($con,'SELECT * FROM subjects');
while($row=mysqli_fetch_array($res,MYSQL_NUM)){
print_r($row);
}
?>
举报