-2
我在下面的php中得到以下錯誤,這是用來從mysql數據庫中獲取圖表信息。欣賞的幫助mysqli_query(),mysqli_select_db()期望至少2個參數
警告:mysqli_query()預計至少2個參數,1 C中給出:\瓦帕\ WWW \第5行 警告試驗\ getuser.php:mysqli_select_db()期望的是2個參數, 1在C中給出:\瓦帕\ WWW \第6行 呼叫未定義的函數mysqli_fetch測試\ getuser.php()在C:\瓦帕\ WWW \達達\ getuser.php上線18
PHP,
<?php
header("Content-type=text/json;charset=UTF-8");
$aVar = mysqli_connect('localhost', 'root', '123');
mysqli_query("set names utf-8");
mysqli_select_db("test");
$resultset = mysqli_query($aVar,"SELECT name, age FROM echartsuser");
$data = array();
class User{
public $username;
public $age;
}
while($row = mysqli_fetch_assoc($resultset);
$user = new User();
$user->username = $row['name'];
$user->age = $row['age'];
$data[] = $user;
}
mysqli_close();
echo json_encode($data);
?>
正如錯誤告訴你 –
嘗試Google提問的標題 –
看到:http://stackoverflow.com /問題/ 23484158/mysqli的查詢-預計-AT-至少-2-參數-1-給出式 –