Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/265.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/oop/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php can';从数据库中设置CellValue,但静态值有效吗?_Php - Fatal编程技术网

Php can';从数据库中设置CellValue,但静态值有效吗?

Php can';从数据库中设置CellValue,但静态值有效吗?,php,Php,我正在使用此代码从数据库中设置cellvalue,但它不起作用 $excel2 = PHPExcel_IOFactory::createReader('Excel2007'); $excel2 = $excel2->load("test.xlsx"); // Empty Sheet $excel2->getActiveSheet()->setCellValue('A1', 'Date'); $m=2; $result=mysqli_

我正在使用此代码从数据库中设置cellvalue,但它不起作用

    $excel2 = PHPExcel_IOFactory::createReader('Excel2007');
    $excel2 = $excel2->load("test.xlsx"); // Empty Sheet


    $excel2->getActiveSheet()->setCellValue('A1', 'Date');

    $m=2;
    $result=mysqli_query($con,"select * from settings");

    while($row=mysqli_fetch_array($result))
    {
      $chan=$row['channelID'];
                $excel2->getActiveSheet()->setCellValue("C$m", $chan);
    echo $chan;
    echo "<br>";
    $m++;
    }
我不知道我哪里做错了,我想从数据库中设置值
如果有任何帮助,我们将不胜感激。

您从查询中得到任何结果吗?是的,我得到了值,但我无法使用这些值设置CellValues。您确定
$row['channelID']
有值吗?是的,它在我回显时显示值,但无法设置为cell value?
 $excel2->getActiveSheet()->setCellValue("C$m", "static text");