This topic is locked

MS SQL Stored Procedure on View Page

12/31/2015 2:30:53 PM
PHPRunner General questions
L
lcslouis author

I have a stored procedure that is called GetTotal.
It accepts a parameter which in this case should be the IDNum which is the ID field Name.


CustomQuery("EXEC GetTotal '" . $values["IDNum"] . "'");


I need to display the result of this stored procedure on the view page.
I know I have to use custom view but It is not documented in the manual on how to run a procedure like this.

Sergey Kornilov admin 12/31/2015

If your stored procedure returns a recordset you can simply use DBLookup function:
$var = DBLookup("EXEC GetTotal '" . $values["IDNum"] . "'");
More info:

http://xlinesoft.com/phprunner/docs/dblookup.htm
If your stored procedures returns multiple fields or multiple records you can use standard functions that work with select queries, just use your stored procedure call instead of SELECT i.e.

$sql = ""EXEC GetTotal '" . $values["IDNum"] . "'"";

$rs = CustomQuery($sql);

$data = db_fetch_array($rs);

echo $data["FieldName"];