php - jasperphp error passing parameters -
in jasper report have sql sentence this:
select * table $p!{my_where}
in php program, i'm calling report way:
jasperphp::process( base_path() . '/app/reports/report.jasper', false, array("pdf"), array("my_where" => "where field = value"), \config::get('database.connections.mysql') )->execute();
then, error message:
wrong report param format!
doing simple way works, mean:
in report:
select * table $p!{field} = $p{value}
in php:
jasperphp::process( base_path() . '/app/reports/report.jasper', false, array("pdf"), array("field" => $my_field, "value" => $my_value), \config::get('database.connections.mysql') )->execute();
the thing is, need build clause dynamically several fields, so, passing "where" parameter must.
any idea?
solved: necessary double quote parameter:
$my_where = '"' . $my_where . '"'; jasperphp::process( base_path() . '/app/reports/report.jasper', false, array("pdf"), array("my_where" => $my_where), \config::get('database.connections.mysql') )->execute();