我有一個問題。 我嘗試打印所有名稱插入到數據庫,但輸出是這樣的:打印一個db文件的所有名稱
array(2) { [0]=> string(7) "Antonio" ["Nome"]=> string(7) "Antonio" } array(2) { [0]=> string(5) "Paolo" ["Nome"]=> string(5) "Paolo" } array(2) { [0]=> string(7) "Giorgio" ["Nome"]=> string(7) "Giorgio" } array(2) { [0]=> string(5) "Jonny" ["Nome"]=> string(5) "Jonny" } array(2) { [0]=> string(7) "salmone" ["Nome"]=> string(7) "salmone" } array(2) { [0]=> string(7) "Paolino" ["Nome"]=> string(7) "Paolino" } array(2) { [0]=> string(8) "Maurizio" ["Nome"]=> string(8) "Maurizio" } array(2) { [0]=> string(9) "Gennarino" ["Nome"]=> string(9) "Gennarino" } array(2) { [0]=> string(6) "Giallo" ["Nome"]=> string(6) "Giallo" } array(2) { [0]=> string(5) "Leroy" ["Nome"]=> string(5) "Leroy" } array(2) { [0]=> string(11) "Verdefoglia" ["Nome"]=> string(11) "Verdefoglia" } array(2) { [0]=> string(5) "Bravo" ["Nome"]=> string(5) "Bravo" } array(2) { [0]=> string(5) "Mondo" ["Nome"]=> string(5) "Mondo" } array(2) { [0]=> string(4) "Soil" ["Nome"]=> string(4) "Soil" } array(2) { [0]=> string(8) "Tiburzio" ["Nome"]=> string(8) "Tiburzio" } array(2) { [0]=> string(5) "potrt" ["Nome"]=> string(5) "potrt" } array(2) { [0]=> string(4) "Creo" ["Nome"]=> string(4) "Creo" }
我的代碼是這樣的:
$results = $database->query('SELECT Nome FROM Studenti');
while ($row = $results->fetchArray()){
var_dump($row);
值爲什麼是一個問題? –
這正是它應該輸出的內容。你得到一個有一個字段的關聯數組。你期望什麼? – Jerodev
只有名稱沒有(數組)} [(字符串)在輸出 – neoblade11