0
我有一個數組包含庫存項目的「Category」,「Group」和「Subgroup」上的mysql查詢結果。我需要構建一個動態菜單,但是我正在構建的數組的當前行的內容取決於下一行中的列。如何在mysql結果中向前看
我查過了,發現了很多例子,但是他們都檢查了數組的整行(mysql行)我只想檢查數組行中的一個項目(一個mysql列)。我需要這樣的東西
for ($ix = 0; $ix < (length(current_result) - 1); $ix++) {
if (current_result[$ix, Catagory] = current_result[$ix + 1, Catagory]) {
echo some code
} else {
echo some other code
}
}
some code to handle the last line of the array
什麼導致你需要@約翰·哈特 –