嗨,当打印动态列的名称时,一切都是正确的,没有出现任何错误,但是在连续打印我的动态数据时,我只在两个代码位置出现错误,我还在出现错误的地方发表评论,请检查一次并建议我从某种角度 -
动态列代码-
$out_table = '';
$k = 0;
mysql_data_seek($query_result1, 0);
$col = 36;
while ($row1 = mysql_fetch_array($query_result1, MYSQL_ASSOC)) {
$sheet->setCellValueByColumnAndRow($col, 1, trim($labels[$k] . " (value1)", ','));
$sheet->setCellValueByColumnAndRow($col + 1, 1, trim($labels[$k] . " (value2)", ','));
$col = $col + 2;
$k++;
}
echo $out_table;
但是在为列打印动态数据时,我遇到了错误-
$inn_table = "";
if (isset($result['qualification']['dd1'])) {
if ($result['qualification']['dd1'] != "") {
$dd1 = explode(",", $result['qualification']['dd1']);
}
}
if (isset($result['qualification']['dd2'])) {
if ($result['qualification']['dd2'] != "") {
$dd2 = explode(",", $result['qualification']['dd2']);
}
}
for ($i = 0; $i < count($labels); $i++) {
if (isset($temp)) {
if ($result['qualification']['dd1'] != "") {
$found = false;
for ($j = 0; $j < count($dd1); $j++) {
$temp = explode(">", $dd1[$j]);
if ($temp[0] == $labels[$i]) {
$name = explode(">", $dd1[$j]);
$inn_table .= '<td>' . $name[1] . '</td>'; **if i comment it getting no error also no data**
// echo '<pre>ass';print_r($dd1);die();
$found = true;
break;
}
}
if (!$found)
$inn_table .= "<td> </td>";
}
} else
$inn_table .= "<td> </td>";
if (isset($result['qualification']['dd2'])) {
if ($result['qualification']['dd2'] != "") {
$found = false;
echo '<pre>ass';print_r($dd2);die;
if (isset($temp)) {
for ($j = 0; $j < count($dd2); $j++) {
$temp = explode(">", $dd2[$j]);
if ($temp[0] == $labels[$i]) {
$name = explode(">", $dd2[$j]);
$inn_table .= '<td>' . $name[1] . '</td>'; **if i comment it getting no error also no data**
$found = true;
break;
}
}
}
if (!$found)
$inn_table .= '<td> </td>';
}
} else {
$inn_table .= '<td> </td>';
}
}
echo $inn_table;
echo "</tr>";
}