Collections:
mssql_close() - Disconnecting from a SQL Server
How To Disconnect from a SQL Server using mssql_close()?
✍: Guest
When you call mssql_connect(), it will return an object representing the connection to the SQL Server. This connection object will be used by subsequent MSSQL function calls. When you are done with this connection, you should close it to free up resources by calling the mssql_close() function.
The tutorial script below shows you how to call mssql_connect() and mssql_close() to connect and disconnect to the SQL Server:
<?php $con = mssql_connect('LOCALHOST','sa','FYIcenter'); if (!$con) { print("Connection failed with error.\n"); } else { print("The SQL Server connection object is ready.\n"); mssql_close($con); } ?>
If you run this script and get this output: "The SQL Server connection object is ready", your connection to the SQL Server are working.
Note that 'sa' and 'FYIcenter' used in this script are system administrator login name and password. You may use any other login name and password defined on the SQL Server.
⇒ mssql_select_db() - Selecting an Exiting Database
⇐ Commonly Used MSSQL Functions in PHP
⇑ SQL Server FAQs - PHP MSSQL Functions - Connections and Query Execution
2024-04-07, 1719🔥, 0💬
Popular Posts:
How To Format Time Zone in +/-hh:mm Format in SQL Server Transact-SQL? From the previous tutorial, y...
How To Format DATETIME Values to Strings with the CONVERT() Function in SQL Server Transact-SQL? SQL...
What To Do If the StartDB.bat Failed to Start the XE Instance in Oracle? If StartDB.bat failed to st...
What Happens If the UPDATE Subquery Returns Multiple Rows in SQL Server? If a subquery is used in a ...
How To Assign Debug Privileges to a User in Oracle? In order to run SQL Developer in debug mode, the...