I use codeigniter 4 and PhpSpreadsheet to export data to excel..when I try it on localhost there are no problems..but when I try it on hosting, when I export I get an error
ParseError syntax error, unexpected '|', expecting ';' or '{' FCPATH/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php at line 269
my model
public function datapmk($tr = null, $thn = null)
{
$this->db = \Config\Database::connect();
$triwulan = "'%" . $tr . "%'";
$tahun = "'%" . $thn . "%'";
$this->select("lingkungan_nama,
COUNT( DISTINCT(urut_rumah)) rmh,
SUM(CASE WHEN pmk_id = 1 AND jk = 1 AND triwulan_id LIKE $triwulan AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS L_tidak,
SUM(CASE WHEN pmk_id = 1 AND jk = 2 AND triwulan_id LIKE $triwulan AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS P_tidak,
SUM(CASE WHEN pmk_id = 1 AND triwulan_id LIKE $triwulan AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS JLH_tidak");
$this->groupBy('lingkungan_nama');
$this->orderBy('lingkungan_nama', 'ASC');
return $this->get()->getResultArray();
}
php installed on hosting v 8.1.31
I use codeigniter 4 and PhpSpreadsheet to export data to excel..when I try it on localhost there are no problems..but when I try it on hosting, when I export I get an error
ParseError syntax error, unexpected '|', expecting ';' or '{' FCPATH/vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php at line 269
my model
public function datapmk($tr = null, $thn = null)
{
$this->db = \Config\Database::connect();
$triwulan = "'%" . $tr . "%'";
$tahun = "'%" . $thn . "%'";
$this->select("lingkungan_nama,
COUNT( DISTINCT(urut_rumah)) rmh,
SUM(CASE WHEN pmk_id = 1 AND jk = 1 AND triwulan_id LIKE $triwulan AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS L_tidak,
SUM(CASE WHEN pmk_id = 1 AND jk = 2 AND triwulan_id LIKE $triwulan AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS P_tidak,
SUM(CASE WHEN pmk_id = 1 AND triwulan_id LIKE $triwulan AND tahun LIKE $tahun THEN 1 ELSE 0 END) AS JLH_tidak");
$this->groupBy('lingkungan_nama');
$this->orderBy('lingkungan_nama', 'ASC');
return $this->get()->getResultArray();
}
php installed on hosting v 8.1.31
Share Improve this question edited Mar 14 at 16:35 James Z 12.3k10 gold badges27 silver badges47 bronze badges asked Mar 14 at 5:47 Franky MoedakFranky Moedak 112 bronze badges1 Answer
Reset to default 0I suspect you will find that your Web hosting is running an older version of PHP. Equally you should look in /vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Spreadsheet.php at line 269 and see what is there.