我有一些陣列這樣
當我使用這樣的代碼:
呼叫特定列在陣列
我得到這個錯誤:在 d users_id::通知:未定義指數\ XAMPP \ htdocs中\ home \ database \ index.php on line 21
我想調用特定的列,如users_id,users_username等。
如果我使用:
var_dump ($rowset);
我:
Array ([0] => Array ([users_id] => 1 [users_username] => admin [users_password] => admin
我的代碼:
$rowset = array();
while ($row = $sql->fetch(PDO::FETCH_ASSOC)){ `enter code here`
$rowset[] = $row;
}
echo $rowset["users_id"];// Line 21
感謝
[PHP的可能重複: 「請注意:未定義的變量」, 「通知:未定義指數」 和「注意:Undefined offset「](http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-notice-undefined-index-and-notice-undef) –
你需要得到什麼? – apokryfos