darksniperx Posted December 23, 2008 Share Posted December 23, 2008 I have pear mdb2 module installed on my php sandbox. I am trying to run a stored procedure and cant get it to work. I get a blank page. The stored procedure it self is fine, since I can use it in sql query analyser. I have searched the net and found the following code. <?php require_once 'MDB2.php'; $dsn = array( 'phptype' => 'mssql', 'username' => $_POST['user'], 'password' => $_POST['pass'], 'hostspec' => $_POST['host'], 'database' => $_POST['db'], ); $options = array( 'debug' => 2, 'portability' => MDB2_PORTABILITY_ALL, ); $mdb2 =& MDB2::connect($dsn, $options); if (PEAR::isError($mdb2)) { die($mdb2->getMessage(). ', ' . $mdb2->getDebugInfo()); } echo "Connected!"; $sth = $mdb2->prepare("exec getItem") or die($sth->getMessage(). ', ' . $sth->getDebugInfo()); $bindvars = array("id" => 'a123', "count" => 8, "location" => 'system'); $res=$mdb2->execute($sth,$bindvars)or die($res->getMessage(). ', ' . $res->getDebugInfo()); $result=$res->fetchRow()[0]; echo $result; ?> I can connect to db without any issues, I just cant run the stored procedure. Thank you! Link to comment https://forums.phpfreaks.com/topic/138244-solved-running-a-stored-procedure-on-mssql/ Share on other sites More sharing options...
corbin Posted December 25, 2008 Share Posted December 25, 2008 What error does it give you? Link to comment https://forums.phpfreaks.com/topic/138244-solved-running-a-stored-procedure-on-mssql/#findComment-723479 Share on other sites More sharing options...
darksniperx Posted January 27, 2009 Author Share Posted January 27, 2009 What error does it give you? Well it doesnt give me any error, I get a blank page. I have tryed to pinpoint the issue and I get the issue at this line $sth=MDB2->prepare("exec Link to comment https://forums.phpfreaks.com/topic/138244-solved-running-a-stored-procedure-on-mssql/#findComment-747855 Share on other sites More sharing options...
darksniperx Posted January 28, 2009 Author Share Posted January 28, 2009 Hi I was just missing function include. I dont get that error once I have added the include. Link to comment https://forums.phpfreaks.com/topic/138244-solved-running-a-stored-procedure-on-mssql/#findComment-748558 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.