{"id":78950,"date":"2026-11-10T19:45:25","date_gmt":"2026-11-10T19:45:25","guid":{"rendered":"http:\/\/bangla.sitestree.com\/?p=78950"},"modified":"2026-11-10T19:56:13","modified_gmt":"2026-11-10T19:56:13","slug":"rewritten-sql-server-26207","status":"publish","type":"post","link":"http:\/\/bangla.sitestree.com\/?p=78950","title":{"rendered":"Migrating Legacy PHP SQL Server Stored Procedure Code to Supported Drivers"},"content":{"rendered":"<p>Older PHP tutorials used the obsolete mssql_* extension for SQL Server procedure calls. A modern rewrite should preserve the application behaviour while changing the database access layer.<\/p>\n<h2>Legacy concepts<\/h2>\n<p>mssql_init established a procedure call, mssql_bind supplied values, and mssql_execute ran the operation. These functions are not available in standard modern PHP installations.<\/p>\n<h2>Use PDO_SQLSRV for a simple procedure<\/h2>\n<pre><code>$db = new PDO(\n    \"sqlsrv:Server=localhost;Database=TrainingDB\",\n    getenv(\"DB_USER\"), getenv(\"DB_PASSWORD\"),\n    [PDO::ATTR_ERRMODE =&gt; PDO::ERRMODE_EXCEPTION]\n);\n$cmd = $db-&gt;prepare(\"EXEC dbo.GetCustomerById @CustomerID = ?\");\n$cmd-&gt;execute([123]);\n$rows = $cmd-&gt;fetchAll(PDO::FETCH_ASSOC);<\/code><\/pre>\n<h2>Output parameter caveat<\/h2>\n<p>Input, output, and input\/output parameter handling differs by driver. Consult current Microsoft SQLSRV and PDO_SQLSRV documentation and test nulls, Unicode strings, and multiple result sets.<\/p>\n<h2>Protect the application<\/h2>\n<p>Use least-privilege permissions, encrypted validated connections, parameterized values, exception logging, and HTML escaping at output time. Keep secrets outside the web root.<\/p>\n<hr\/>\n<p><strong>AI disclosure and reuse:<\/strong> This AI-generated article is rewritten from <a href=\"https:\/\/bangla.sitestree.com\/?p=26207\">an existing Open Education post (ID 26207)<\/a>. Additional explanations, code examples, and version notes may have been added. You may reuse the newly generated article text with or without attribution. Third-party trademarks and linked works retain their own rights. <strong>AI can make mistakes.<\/strong> Check examples, permissions, supported SQL Server versions, and documentation before use in any live system.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Older PHP tutorials used the obsolete mssql_* extension for SQL Server procedure calls. A modern rewrite should preserve the application behaviour while changing the database access layer.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[20,182],"tags":[466],"class_list":["post-78950","post","type-post","status-publish","format-standard","hentry","category-information-technology","category---blog","tag-sql-server","item-wrap"],"jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":78935,"url":"http:\/\/bangla.sitestree.com\/?p=78935","url_meta":{"origin":78950,"position":0},"title":"PHP Functions for SQL Server: Historical MSSQL APIs and Supported Replacements","author":"Sayed","date":"November 10, 2026","format":false,"excerpt":"A historic PHP API family exposed functions beginning with mssql_, including connection management, result fetching, stored-procedure execution, and metadata inspection. That API is no longer suitable for modern PHP applications.","rel":"","context":"In &quot;Information Technology&quot;","block_context":{"text":"Information Technology","link":"http:\/\/bangla.sitestree.com\/?cat=20"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78969,"url":"http:\/\/bangla.sitestree.com\/?p=78969","url_meta":{"origin":78950,"position":1},"title":"Calling SQL Server Stored Procedures from Modern PHP: A Migration Tutorial","author":"Sayed","date":"November 10, 2026","format":false,"excerpt":"Old PHP code often used mssql_init, mssql_bind and mssql_execute. Those APIs are obsolete, but their basic goal\u2014calling a SQL Server stored procedure with typed parameters\u2014remains common.","rel":"","context":"In &quot;Information Technology&quot;","block_context":{"text":"Information Technology","link":"http:\/\/bangla.sitestree.com\/?cat=20"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":78934,"url":"http:\/\/bangla.sitestree.com\/?p=78934","url_meta":{"origin":78950,"position":2},"title":"Calling SQL Server Stored Procedures from PHP: Modern Drivers and Examples","author":"Sayed","date":"November 10, 2026","format":false,"excerpt":"Early PHP applications commonly used mssql_connect, mssql_init, and mssql_bind. Those functions belonged to an obsolete extension and should not be copied into a new application.","rel":"","context":"In &quot;Information Technology&quot;","block_context":{"text":"Information Technology","link":"http:\/\/bangla.sitestree.com\/?cat=20"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6085,"url":"http:\/\/bangla.sitestree.com\/?p=6085","url_meta":{"origin":78950,"position":3},"title":"\u09aa\u09bf\u098f\u0987\u099a\u09aa\u09bf : \u098f\u0995\u099f\u09bf \u09ae\u09be\u0987\u098f\u09b8\u0995\u09bf\u0989\u098f\u09b2 \u09a1\u09be\u099f\u09be\u09ac\u09c7\u099c \u09a4\u09c8\u09b0\u09bf \u0995\u09b0\u09be (PHP Create a MySQL Database)","author":"Author-Check- Article-or-Video","date":"February 24, 2015","format":false,"excerpt":"Sheikh Mahfuzur Rahman \u00a0 \u098f\u0995\u099f\u09bf \u09a1\u09be\u099f\u09be\u09ac\u09c7\u099c \u098f\u0995 \u09ac\u09be \u09a4\u09be\u09b0\u0993 \u09ac\u09c7\u09b6\u09bf \u099f\u09c7\u09ac\u09b2 \u09a8\u09bf\u09df\u09c7 \u0997\u09a0\u09bf\u09a4\u0964 \u0995\u09cb\u09a8 MySQL \u09a1\u09be\u099f\u09be\u09ac\u09c7\u099c \u09a4\u09c8\u09b0\u09bf \u09ac\u09be \u09ae\u09c1\u0981\u099b\u09c7 \u09a6\u09bf\u09a4\u09c7 \u099a\u09be\u0987\u09b2\u09c7 \u0986\u09aa\u09a8\u09be\u09b0 \u09ac\u09bf\u09b6\u09c7\u09b7 \u09a7\u09b0\u09a3\u09c7\u09b0 \u0986\u0987\u09a8\u0997\u09a4 \u0985\u09a7\u09bf\u0995\u09be\u09b0 \u09b2\u09be\u0997\u09ac\u09c7 \u09af\u09be CREATE \u09a8\u09be\u09ae\u09c7 \u09aa\u09b0\u09bf\u099a\u09bf\u09a4\u0964 MySQLi \u098f\u09ac\u0982 PDO \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0 \u0995\u09b0\u09c7 \u098f\u0995\u099f\u09bf \u09ae\u09be\u0987\u098f\u09b8\u0995\u09bf\u0989\u098f\u09b2 \u09a1\u09be\u099f\u09be\u09ac\u09c7\u099c \u09a4\u09c8\u09b0\u09bf \u0995\u09b0\u09be CREATE DATABASE \u09b8\u09cd\u099f\u09c7\u099f\u09ae\u09c7\u09a8\u09cd\u099f \u09ae\u09be\u0987\u098f\u09b8\u0995\u09bf\u0989\u098f\u09b2-\u098f \u098f\u0995\u099f\u09bf \u09a1\u09be\u099f\u09be\u09ac\u09c7\u099c \u09a4\u09c8\u09b0\u09bf \u0995\u09b0\u09a4\u09c7 \u09ac\u09cd\u09af\u09ac\u09b9\u09c3\u09a4\u2026","rel":"","context":"In &quot;\u09aa\u09bf \u098f\u0987\u099a \u09aa\u09bf \u099f\u09bf\u0989\u099f\u09cb\u09b0\u09bf\u09df\u09be\u09b2 \u0964 PHP tutorial&quot;","block_context":{"text":"\u09aa\u09bf \u098f\u0987\u099a \u09aa\u09bf \u099f\u09bf\u0989\u099f\u09cb\u09b0\u09bf\u09df\u09be\u09b2 \u0964 PHP tutorial","link":"http:\/\/bangla.sitestree.com\/?cat=172"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6146,"url":"http:\/\/bangla.sitestree.com\/?p=6146","url_meta":{"origin":78950,"position":4},"title":"\u09aa\u09bf\u098f\u0987\u099a\u09aa\u09bf &#8211; \u09ae\u09be\u0987\u098f\u09b8\u0995\u09bf\u0989\u098f\u09b2 \u098f \u098f\u0995\u09be\u09a7\u09bf\u0995 \u09b0\u09c7\u0995\u09b0\u09cd\u09a1 \u09aa\u09cd\u09b0\u09ac\u09c7\u09b6 \u0995\u09b0\u09be\u09a8\u09cb  (PHP &#8211; Insert Multiple Records Into MySQL in Bangla)","author":"Author-Check- Article-or-Video","date":"February 2, 2015","format":false,"excerpt":"\u09ae\u09cb\u0983 \u0986\u09b0\u09bf\u09ab\u09c1\u09b2 \u0987\u09b8\u09b2\u09be\u09ae MySQLi \u098f\u09ac\u0982 PDO \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0 \u0995\u09b0\u09c7 \u09ae\u09be\u0987\u098f\u09b8\u0995\u09bf\u0989\u098f\u09b2 \u098f\u09b0 \u09ae\u09a7\u09cd\u09af\u09c7 \u098f\u0995\u09be\u09a7\u09bf\u0995 \u09a1\u09be\u099f\u09be \u09b0\u09c7\u0995\u09b0\u09cd\u09a1\u09b8 \u09aa\u09cd\u09b0\u09ac\u09c7\u09b6 \u0995\u09b0\u09be\u09a8 \u098f\u0995\u09be\u09a7\u09bf\u0995 SQL statements \u0995\u09c7 executed (\u0989\u09a6\u09cd\u09a6\u09bf\u09aa\u09cd\u09a4) \u0995\u09b0\u09be\u09b0 \u099c\u09a8\u09cd\u09af mysqli_multi_query() function (\u09ab\u09be\u0982\u09b6\u09a8) \u09ac\u09cd\u09af\u09be\u09ac\u09b9\u09be\u09b0 \u0995\u09b0\u09a4\u09c7 \u09b9\u09ac\u09c7\u0964 \u09a8\u09bf\u09ae\u09cd\u09a8\u09b2\u09bf\u0996\u09bf\u09a4 \u0989\u09a6\u09be\u09b9\u09b0\u09a3\u0997\u09c1\u09b2\u09bf \"MyGuests\" \u099f\u09c7\u09ac\u09bf\u09b2 \u098f \u09a4\u09bf\u09a8\u099f\u09bf \u09a8\u09a4\u09c1\u09a8 \u09b0\u09c7\u0995\u09b0\u09cd\u09a1 \u09af\u09cb\u0997 \u0995\u09b0\u09be\u09ac\u09c7: MySQLi Object-oriented \u098f\u09b0 \u0989\u09a6\u09be\u09b9\u09b0\u09a3- <?php $servername = \"localhost\"; $username =\u2026","rel":"","context":"In &quot;\u09aa\u09bf \u098f\u0987\u099a \u09aa\u09bf \u099f\u09bf\u0989\u099f\u09cb\u09b0\u09bf\u09df\u09be\u09b2 \u0964 PHP tutorial&quot;","block_context":{"text":"\u09aa\u09bf \u098f\u0987\u099a \u09aa\u09bf \u099f\u09bf\u0989\u099f\u09cb\u09b0\u09bf\u09df\u09be\u09b2 \u0964 PHP tutorial","link":"http:\/\/bangla.sitestree.com\/?cat=172"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6089,"url":"http:\/\/bangla.sitestree.com\/?p=6089","url_meta":{"origin":78950,"position":5},"title":"\u09aa\u09bf\u098f\u0987\u099a\u09aa\u09bf &#8211; \u09ae\u09be\u0987\u098f\u09b8\u0995\u09bf\u0989\u098f\u09b2  \u098f \u09a1\u09be\u099f\u09be \u09aa\u09cd\u09b0\u09ac\u09c7\u09b6 \u0995\u09b0\u09be\u09a8\u09cb (PHP Insert Data Into MySQL in Bangla)","author":"Author-Check- Article-or-Video","date":"February 22, 2015","format":false,"excerpt":"\u09b6\u09c7\u0996 \u09ae\u09be\u09b9\u09ab\u09c1\u099c\u09c1\u09b0 \u09b0\u09b9\u09ae\u09be\u09a8 \u00a0 MySQLi \u098f\u09ac\u0982 PDO \u09ac\u09cd\u09af\u09ac\u09b9\u09be\u09b0 \u0995\u09b0\u09c7 \u09ae\u09be\u0987\u098f\u09b8\u0995\u09bf\u0989\u098f\u09b2 \u098f \u09a1\u09be\u099f\u09be \u09aa\u09cd\u09b0\u09ac\u09c7\u09b6 \u0995\u09b0\u09be\u09a8\u09cb \u098f\u0995\u099f\u09bf \u09a1\u09be\u099f\u09be\u09ac\u09c7\u099c \u098f\u09ac\u0982 \u098f\u0995\u099f\u09bf \u099f\u09c7\u09ac\u09b2 \u09a4\u09c8\u09b0\u09bf \u0995\u09b0\u09be\u09b0 \u09aa\u09b0 \u0986\u09ae\u09b0\u09be \u09a4\u09be\u09a4\u09c7 \u09a1\u09be\u099f\u09be \u09af\u09cb\u0997 \u0995\u09b0\u09be \u09b6\u09c1\u09b0\u09c1 \u0995\u09b0\u09a4\u09c7 \u09aa\u09be\u09b0\u09bf\u0964 \u098f\u0995\u09cd\u09b7\u09c7\u09a4\u09cd\u09b0\u09c7 \u09af\u09c7\u09b8\u09ac \u09b8\u09bf\u09a8\u099f\u09c7\u0995\u09cd\u09b8\u099f-\u09a8\u09bf\u09df\u09ae \u0985\u09a8\u09c1\u09b0\u09b8\u09b0\u09a8 \u0995\u09b0\u09a4\u09c7 \u09b9\u09ac\u09c7\u0983 SQL \u0995\u09cb\u09df\u09be\u09b0\u09bf\u099f\u09bf \u0985\u09ac\u09b6\u09cd\u09af\u0987 PHP \u098f\u09b0 \u09ad\u09bf\u09a4\u09b0 \u0995\u09cb\u099f\u09c7\u09a1 \u09b9\u09a4\u09c7 \u09b9\u09ac\u09c7\u0964 SQL \u0995\u09cb\u09df\u09be\u09b0\u09bf\u09b0 \u09ad\u09c7\u09a4\u09b0 \u09b8\u09cd\u099f\u09cd\u09b0\u09bf\u0982 \u09ad\u09cd\u09af\u09be\u09b2\u09c1\u099f\u09bf\u2026","rel":"","context":"In &quot;\u09aa\u09bf \u098f\u0987\u099a \u09aa\u09bf \u099f\u09bf\u0989\u099f\u09cb\u09b0\u09bf\u09df\u09be\u09b2 \u0964 PHP tutorial&quot;","block_context":{"text":"\u09aa\u09bf \u098f\u0987\u099a \u09aa\u09bf \u099f\u09bf\u0989\u099f\u09cb\u09b0\u09bf\u09df\u09be\u09b2 \u0964 PHP tutorial","link":"http:\/\/bangla.sitestree.com\/?cat=172"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78950","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=78950"}],"version-history":[{"count":1,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78950\/revisions"}],"predecessor-version":[{"id":79012,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=\/wp\/v2\/posts\/78950\/revisions\/79012"}],"wp:attachment":[{"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=78950"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=78950"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/bangla.sitestree.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=78950"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}