由于某种原因,这个数组不断重复第一行到第二行,第一行和第二行到第三行,依此类推。
unset ($grade); $grade = array();
foreach ($row as $grade => $value) {
if (substr($grade, 0,1)== "y") {
if ($grade == "y1") {if ($value == "x") {$grades[] = "1";}}
if ($grade == "y2") {if ($value == "x") {$grades[] = "2";}}
if ($grade == "y3") {if ($value == "x") {$grades[] = "3";}}
if ($grade == "y4") {if ($value == "x") {$grades[] = "4";}}
if ($grade == "y5") {if ($value == "x") {$grades[] = "5";}}
if ($grade == "y6") {if ($value == "x") {$grades[] = "6";}}
if ($grade == "y7") {if ($value == "x") {$grades[] = "7";}}
}}
$grades_string = implode(", ", $grades);
dB 行的标题为 y1、y2 等。如果需要,我可以向某人展示一个链接,其中包含我的意思是错误的示例。