0

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

} 
Utsaww
  • 13
  • 3
  • How you can append `` without start or define a `` and `` tag ? This is not the correct way
    – PHP Ninja Dec 03 '19 at 06:25
  • You should _always_ post the complete error message you want us to help you with. Don't make us read all the code and guess. – M. Eriksson Dec 03 '19 at 06:25
  • @Gulshan could you please suggest how can i write $inn_table .= '' . $name[1] . ''; into a phpexcel form? – Utsaww Dec 03 '19 at 08:31
  • @Utsaww what are requirements to add `td` in excel. Mostly we add data into columns in excel format.What is actually trying to doing here? – PHP Ninja Dec 03 '19 at 09:00
  • i am adding data into columns but i am confused how to add it in phpexcel format because it doesn't except td – Utsaww Dec 03 '19 at 09:08

0 Answers0