Home>

I want to download data from a specific table from a MYSQL database in PHP.
Data of other tables can be downloaded from the same DB,
When I try to DL the data of a specific table, I get a syntax error.

Error message
Parse error: syntax error, unexpected 'answer1' (T_STRING), expecting ']' in /usr/home/〇〇〇〇/html/〇〇〇_back/downloadtest/〇〇〇〇.php on line 46
Applicable source code
<? php
mb_language ("Japanese");
mb_internal_encoding ("UTF-8");
ini_set ('display_errors', 1);
ini_set ('error_reporting', E_ERROR);

include "../Db.inc";

$export_csv_title = array ("id", "list_id", "user_id", "exclusion", "result1", "result_name1", "result2", "result_name2", "result3", "result_name3", "result_status", " result "," comment "," answer1 "," answer2 "," answer3 "," admin_user "," update_admin_user "," created "," modified ");
     // CSV output
$file_path = 'list_datas'. $id. ".csv";
header ('Content-Type: text/csv');
header ('Content-Disposition: attachment;filename ='. $file_path);

    foreach ($export_csv_title as $key =>$val) {
        echo mb_convert_encoding ($val, 'SJIS-win', 'UTF-8');
        echo ",";
    }
echo "
";

$sql = "SELECT * from list_datas";
foreach ($00__dbh->query ($sql) as $row) {
    mb_convert_variables ('SJIS-win', 'UTF-8', $row);
    echo $row ['id']. ",";
    echo $row ['list_id']. ",";
    echo $row ['user_id']. ",";
    echo $row ['exclusion']. ",";
    echo $row ['result1']. ",";
    echo $row ['result_name1']. ",";
    echo $row ['result2']. ",";
    echo $row ['result_name2']. ",";
    echo $row ['result3']. ",";
    echo $row ['result_name3']. ",";
    echo $row ['result_status']. ",";
    echo $row ['result]. ",";
    echo $row ['comment']. ",";
    echo $row ['answer1']. ",";
    echo $row ['answer2']. ",";
    echo $row ['answer3']. ",";
    echo $row ['admin_user']. ",";
    echo $row ['update_admin_user']. ",";
    echo $row ['created']. ",";
    echo $row ['modified']. ",";
    echo "
";
}
exit;
?>
Tried

Please describe what you tried for the problem here.

Supplemental information (FW/tool version etc.)

Please provide more detailed information here.