scamquist Posted September 9, 2011 Share Posted September 9, 2011 I am trying to call a stored procedure named RunRefresh. There are no paramaters. When I run exec RunRefresh, a table is refreshed. Nothing is displayed or changed on the php page. I have tried: <?php include('php/SessionSetup.php'); if(isset($_POST['submit'])) { sqlsrv_execute( $conn, runrefresh); echo "Done!"; } else { // display the form ?> <form action="" method="post"> <input type="submit" name="submit" value="DO IT!"> </form> <?php } ?> ------------------------------------------------------------------------------------------------------------------- The procedure does not appear to run. the include('php/SessionSetup.php'); contains the statement include('queries/ConnIris.php'); ------------------------------------------------------------------------------------------------------------------- ConnIris is $serverName = "(local)"; $connectionInfo = array("UID" => "username", "PWD" => "xxx", "Database"=>"MyDb"); $conn = sqlsrv_connect( $serverName, $connectionInfo); ------------------------------------------------------------------------------------------------------------------- I am using IIS (if that makes a difference) Quote Link to comment https://forums.phpfreaks.com/topic/246789-run-stored-procedure-to-refresh-tables/ Share on other sites More sharing options...
AyKay47 Posted September 9, 2011 Share Posted September 9, 2011 you should be receiving an SQL connection error..? I believe that this is a MSSQL bug... try changing $serverName = "127.0.0.1" What OS are you using? Quote Link to comment https://forums.phpfreaks.com/topic/246789-run-stored-procedure-to-refresh-tables/#findComment-1267382 Share on other sites More sharing options...
scamquist Posted September 9, 2011 Author Share Posted September 9, 2011 I changed $serverName = "127.0.0.1" Did not work. the Local is working on about 20 other pages, so the connection is working. The operating system is Server 2003 Service Pack 2 and SQL 2005 Quote Link to comment https://forums.phpfreaks.com/topic/246789-run-stored-procedure-to-refresh-tables/#findComment-1267388 Share on other sites More sharing options...
PFMaBiSmAd Posted September 9, 2011 Share Posted September 9, 2011 Should get you started - http://phpmktime.com/2011/06/calling-mssql-stored-procedure-from-php-sqlsrv/ Quote Link to comment https://forums.phpfreaks.com/topic/246789-run-stored-procedure-to-refresh-tables/#findComment-1267390 Share on other sites More sharing options...
scamquist Posted September 10, 2011 Author Share Posted September 10, 2011 I found a solution by calling a bat file with the following statement in the bat file osql -E -d Iris -S Gamay-srv1 -Q "Exec RunRefresh ; Quote Link to comment https://forums.phpfreaks.com/topic/246789-run-stored-procedure-to-refresh-tables/#findComment-1267745 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.