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 .?
代碼在我自己的回答中,底下是其報的錯
Notice: Undefined variable: res,MYSQL_NUM in /Library/WebServer/Documents/html/mysql_prac.php on line 13
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, null given in /Library/WebServer/Documents/html/mysql_prac.php on line 13
2016-08-08
看看手冊咯
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就行了
2016-08-01
<?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);
}
?>
2016-07-30
不知道你其他的代碼是這么寫的 貼出看看可以嗎?
還是說逗號你打的是中文的?