Telenet Cloud Online Help

How does the connection between PHP and MSSQL work?

A native php mssql driver nl. sqlsrv_connect ipv mssql_connect is used

You will find more information on the following link: http://msdn.microsoft.com/en-us/library/cc296189(SQL.90).aspx

Example of a connection:

<?php
/* Specify the server and connection string attributes. */
$serverName = "(sql27.hostbasket.com)";

/* Get UID and PWD from application-specific files. */
$connectionInfo = array( "UID"=>”test”,
"PWD"=>”testje1”,
"Database"=>"AdventureWorks");

/* Connect using SQL Server Authentication. */
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false )
{
echo "Unable to connect.</br>";
die( print_r( sqlsrv_errors(), true));
}

sqlsrv_close( $conn);
?>

 
Additional information:
 
Working with Microsoft SQL Server driver (php_sqlsrv.dll) for PHP on Windows

http://blogs.iis.net/donraman/archive/2010/01/25/working-with-microsoft-sql-server-driver-php-sqlsrv-dll-for-php-on-windows.aspx

mssql vs. sqlsrv: What’s the Difference? (Part 1)

http://blogs.msdn.com/b/brian_swan/archive/2010/03/08/mssql-vs-sqlsrv-what-s-the-difference-part-1.aspx

SQLSRV Driver API Reference

http://msdn.microsoft.com/en-us/library/cc296152(SQL.90).aspx
 
0 (0)
Article Rating (No Votes)
Rate this article
Attachments
There are no attachments for this article.
Related Articles
How do I hide any PHP errors on my website?
Viewed 1146 times since Tue, Jul 24, 2012
What is PHP?
Viewed 3553 times since Thu, Nov 27, 2008
Is Zend Guard/Optimizer supported?
Viewed 1394 times since Mon, Jul 23, 2012
Is Zend Engine supported?
Viewed 3054 times since Mon, Jul 23, 2012
Can I use PHP on IIS 7 (Windows hosting)?
Viewed 2029 times since Tue, Nov 18, 2008
How do I recognize PHP pages/scripts?
Viewed 4972 times since Tue, Nov 18, 2008
Are PDO and SQLite supported on the shared hosting?
Viewed 2408 times since Tue, Jul 24, 2012
Where can I find the PHP manual?
Viewed 1696 times since Tue, Nov 18, 2008
Which PHP version is installed on the server? Which modules are available?
Viewed 2866 times since Tue, Nov 18, 2008
Is ionCube Encoder/Loader supported?
Viewed 2019 times since Thu, Jul 19, 2012