Note that there are some explanatory texts on larger screens.

plurals
  1. POhow call two procedure at a time from a single php page using MVC Architecture?
    text
    copied!<p>I need to call two procedures which are created in MySQL and that return records in a PHP file. I am not able to call a procedure one after another. If I call one procedure after another procedure (from single PHP page), the second procedure will not return any records.</p> <p>Even if I execute a <code>select</code> stament which returns records after a procedure (which returns records) means <code>select</code> statement will not return any values. Why this is happening? How can we call two procedures one after another in a single PHP page? </p> <p>Hi I am adding my Code Here...</p> <p>model.php file content</p> <pre><code>&lt;?php class DBoperation { function connect(){ $this-&gt;con=mysql_connect('localhost','root',''); mysql_select_db('test',$this-&gt;con); } function call proc2($empcode){ $this-&gt;sql="call proc1('$empcode',@strGrpId,@strTodate,@strAccPrTodt,@strRecalculate)"; } function callproc2($strEmpCode){ $this-&gt;sql="call proc2('$strEmpCode',@a,@b,@c,@d,@e,@f)"; } function execute(){ $res = mysql_query($this-&gt;sql); return $res; } } ?&gt; </code></pre> <p>view.php file content</p> <pre><code>&lt;?php require_once('../../model/model.php'); $empcode = $_SESSION['empcode']; $obj=new DBoperation(); $obj-&gt;connect(); //calling first procedure $obj-&gt;callproc1($empcode); $res = $obj-&gt;execute(); while($result=mysql_fetch_array($res)) { echo $result[0]; } //calling second procedure $obj-&gt;callproc2($empcode); $fetch=$obj-&gt;execute(); while($fetch1=mysql_fetch_array($fetch)){ echo $fetch1[0]; } ?&gt; </code></pre> <p>second procdure returns nothing. if i execute any select queries after second procdeure also i wont return anything.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload