我已經裝箱存儲有關的船隻,當我試圖在PHP中使用這些數據,它的工作信息的數據庫,然後我增加了一些新的領域到數據庫,但是當我在PHP中使用他們,他們返回「未定義的索引:fieldName「。PHP mysqli_fetch_array缺少一些領域
從我所知道的這意味着索引還沒有設置,所以我檢查了數組的內容,發現所有的字段都在那裏,除了新的,但是我能夠在phpmyadmin中查看它們。
的phpMyAdmin: 見圖片:https://dl.dropboxusercontent.com/u/65222600/phpmyadminshot.png
PHP代碼:
<?php
include_once "php/connect.php";
$result = mysqli_query($con,"SELECT * FROM vessels");
while($row = mysqli_fetch_array($result)){
print_r($row);
}
?>
PHP返回:
Array (
[0] => 1 [idVessels] => 1
[1] => 1 [userId] => 1
[2] => cams boat [name] => cams boat
[3] => 1000000000 [price] => 1000000000
[4] => 0 [VAT] => 0
[5] => GBP [Currency] => GBP
[6] => UK [Location] => UK
[7] => ME [builder] => ME
[8] => ME [make] => ME
[9] => ME [model] => ME
[10] => 10/10/13 [yearConstructed] => 10/10/13
[11] => 1 [cabins] => 1
[12] => 1 [heads] => 1
[13] => 1 [#engines] => 1
[14] => ME [engineModel] => ME
[15] => 100 [enginePower] => 100
[16] => petrol [fuelType] => petrol
[17] => 122 [nominalLength] => 122
[18] => 122 [overallLength] => 122
[19] => 122 [waterlineLength] => 122
[20] => 122 [beam] => 122
[21] => 122 [maxDraft] => 122
[22] => leather [hullMaterial] => leather
[23] => MINT [hullType] => MINT
[24] => MINT [keeltype] => MINT
[25] => 122 [displacement] => 122
[26] => 122 [waterCapacity] => 122
[27] => 2014-01-10 02:18:39 [dateAdded] => 2014-01-10 02:18:39
[28] => For Sale [status] => For Sale)
,無處是描述或primaryImageURL。
任何幫助是極大的讚賞,感謝
奇數。你的PHP腳本連接到正確的數據庫權利,而不是一個不同的(產品與DEV)? – mituw16
您需要發佈你的表結構,你的屏幕截圖可能是一個連接的結果。 – jeroen
是的,檢查它是否連接到不同的Db,如@ miuw16 –