Bind dynamic parameters to SQL SP with php pdo <p>This question is related to this <a href="http://stackoverflow.com/questions/36349307/sql-stored-procedure-formatting-error">SQL Stored procedure formatting error</a></p> <p>Wanna bind dynamic parameters from PHP PDO. Only getting results for one parameter(@rep=:rep). When second parameter added won't getting any out put</p> <pre><code>public function ar_report($rep,$market,$agent,$warehouse,$customername,$regionalname){ $query = "{CALL arReports(@rep=:rep,@market=:market)}"; $stmt = $this-&gt;db-&gt;prepare($query); if ($rep != "") { $stmt-&gt;bindParam(':rep', $rep); } if ($market != "") { $stmt-&gt;bindParam(':market', $market); } $stmt-&gt;execute(); $rows = $stmt-&gt;fetchAll(PDO::FETCH_ASSOC); return $rows; } </code></pre>