KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Multiselect - Invalid parameter number Error #701

Open Rafal Ciesielski opened this topic on on Feb 22, 2019 - 1 comments

Rafal Ciesielski commented on Feb 22, 2019

Hello , I use Multiselect input component in Laravel project and in query I need to use twice this same parameters and Laravel is throwing error SQLSTATE[HY093]: Invalid parameter number. If I delete one of the parameters (any), everything works without a problem

       $this->src("mysql")
        ->query("select rok, department,
        at_1, mt_1, pr_1,
        at_2, mt_2, pr_2,
        at_3, mt_3, pr_3,
        at_4, mt_4, pr_4,
        at_5, mt_5, pr_5,
        at_6, mt_6, pr_6,
        at_7, mt_7, pr_7,
        at_8, mt_8, pr_8,
        at_9, mt_9, pr_9,
        at_10, mt_10, pr_10,
        at_11, mt_11, pr_11,
        at_12, mt_12, pr_12,
        at_total, mt_total, pr_total
    from v_report_department
    ".
    (($this->params["dzialy"]!=array())?"WHERE department IN (:dzialy)":"")
    ."
    union all
    select rok, 'Total' as department,
        at_1, mt_1, round(at_1/mt_1*100,0) pr_1,
        at_2, mt_2, round(at_2/mt_2*100,0) pr_2,
        at_3, mt_3, round(at_3/mt_3*100,0) pr_3,
        at_4, mt_4, round(at_4/mt_4*100,0) pr_4,
        at_5, mt_5, round(at_5/mt_5*100,0) pr_5,
        at_6, mt_6, round(at_6/mt_6*100,0) pr_6,
        at_7, mt_7, round(at_7/mt_7*100,0) pr_7,
        at_8, mt_8, round(at_8/mt_8*100,0) pr_8,
        at_9, mt_9, round(at_9/mt_9*100,0) pr_9,
        at_10, mt_10, round(at_10/mt_10*100,0) pr_10,
        at_11, mt_11, round(at_11/mt_11*100,0) pr_11,
        at_12, mt_12, round(at_12/mt_12*100,0) pr_12,
        at_total, mt_total, round(at_total/mt_total*100,0) pr_total
    from (
        select rok,
            sum(at_1) as at_1, sum(mt_1) as mt_1,
            sum(at_2) as at_2, sum(mt_2) as mt_2,
            sum(at_3) as at_3, sum(mt_3) as mt_3,
            sum(at_4) as at_4, sum(mt_4) as mt_4,
            sum(at_5) as at_5, sum(mt_5) as mt_5,
            sum(at_6) as at_6, sum(mt_6) as mt_6,
            sum(at_7) as at_7, sum(mt_7) as mt_7,
            sum(at_8) as at_8, sum(mt_8) as mt_8,
            sum(at_9) as at_9, sum(mt_9) as mt_9,
            sum(at_10) as at_10, sum(mt_10) as mt_10,
            sum(at_11) as at_11, sum(mt_11) as mt_11,
            sum(at_12) as at_12, sum(mt_12) as mt_12,
            sum(at_total) as at_total, sum(mt_total) as mt_total
            from v_report_department
            ".
            (($this->params["dzialy"]!=array())?"WHERE department IN (:dzialy)":"")
            ."
            group by rok
            ) as sub")
KoolReport commented on Feb 22, 2019

This comes from the PDO binding. You may bind differently name for the same report parameters.

->params(array(
    ":dzialy"=>$this->params["dzialy"],
    ":dzialy2"=>$this->params["dzialy"],
))

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

Laravel