KoolReport's Forum

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

How to pass multiple parameters and call the mysql stored procedure in koolreport php #2451

Open Komuraiah A opened this topic on on Nov 22, 2021 - 1 comments

Komuraiah A commented on Nov 22, 2021

Dear Team,I have implemented the code instead of query i have used MYSQL stored procedure.now I'm able to select the data with out passing parameters.but not able to select the data with passing multiple parameters.

below is the code for storedprocedure without parameters

protected function setup()
    {
	$this->src("mydata")->query("CALL sp_testproc()")	
		 ->pipe($this->dataStore("result"));
    } 

below is the code for calling storedprocedure with parameters

protected function setup()
    {
	$this->src("mydata")->query("CALL sp_testproc(@date1=:start, @date2=:end, @id=:id)")
	
		->params(array(                     
			":start"=>$this->params["dateRange"][0],
                        ":end"=>$this->params["dateRange"][1],
			":id"=>$this->params["cid"],
         	
        ))
		
		 ->pipe($this->dataStore("result"));
    } 

please help me the code to how to pass the parameters and how to call the mysql stored procedure

Sebastian Morales commented on Nov 22, 2021

If it's Mysql, should not store procedure's named parameters call be like:

    $this->src("mydata")->query("CALL sp_testproc(@date1 := :start, @date2 := :end, @id := :id)") -- use := instead of =

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

Inputs