-1
我在這段代碼中得到一個未定義的索引錯誤:未定義指數
function get_userdata() {
global $db;
global $user;
global $data, $value, $line;
$id = $_SESSION['exp_user']['userid'];
$row = $db->query("SELECT * FROM tbl_staff WHERE id = $id");
$user = array();
while ($line = $row->fetch_assoc())
{$user[ $line['data'] ] = intval($line['value']);}
}
誤差爲:
Notice: Undefined index: data in /includes/functions.php on line 11
Notice: Undefined index: value in /includes/functions.php on line 11
11號線是{$user[ $line['data'] ] = intval($line['value']);}
。
我在做什麼錯?
謝謝
您確定在tbl_staff表中有一個名爲「data」的字段嗎? – 2011-06-16 15:36:20
tbl_staff中很可能沒有數據和值列。 – 2011-06-16 15:37:14