Example of how PHP uses PDO to call the mssql Stored Procedure, pdomssql
This example describes how PHP uses PDO to call the mssql Stored Procedure. We will share this with you for your reference. The details are as follows:
The stored procedure user_logon_check has been created in the database. The PHP call example is as follows,
<? Php $ dsn = 'mssql: dbname = MyDbName; host = localhost'; $ user = 'sa '; $ password = '2016 '; try {$ dbCon = new PDO ($ dsn, $ user, $ password);} catch (PDOException $ e) {print 'Connection failed :'. $ e-> getMessage (); exit;} $ username = '000000'; $ userpsw = '000000 '; // $ xp_userlogon = $ dbCon-> query ("exec user_logon_check '$ username', '$ userpsw'"); // mysql-> call user_logon_check (' $ username ', '$ userpsw'); // mysql-> Call user_logon_check (?,?) $ Xp_userlogon = $ dbCon-> prepare ('exec user_logon_check ?,? '); $ Xp_userlogon-> bindParam (1, $ username); $ xp_userlogon-> bindParam (2, $ userpsw); $ xp_userlogon-> execute (); $ uCol = $ xp_userlogon-> columnCount (); echo $ uCol. "<br>"; while ($ row = $ xp_userlogon-> fetch () {for ($ I = 0; $ I <$ uCol; $ I ++) print $ row [$ I]. ""; print "<br>" ;}?>