Utsaww
Utsaww

Reputation: 13

Getting Error While printing dynamic Cell and rows data together in PHPExcel?

Hi while printed dynamic column's name everything is correct and not getting any error but while printing my dynamic data in a row i am getting error only at two place of code i also place a comment where i am getting a error please check once and suggest me some ways -

Dynamic Columns code -

 $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; 

But while printing dynamic data for columns i am getting error -

    $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>&nbsp;</td>";
            }
        } else
            $inn_table .= "<td>&nbsp;</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>&nbsp;</td>';
            }
        } else {

            $inn_table .= '<td>&nbsp;</td>';
        }
    }
      echo $inn_table;

     echo "</tr>";

} 

Upvotes: 0

Views: 28

Answers (0)

Related Questions