PHP MSSQL connection

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tutu saint
    New Member
    • Jun 2011
    • 21

    PHP MSSQL connection

    How can i connect PHP script to MSSQL server.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Is the PHP script being executed on a Windows host? If so, I suggest the PDO extension with the PDO_SQLSRV driver, which you can download here, directly from Microsoft.

    If it's on a Unix host, the PDO_ODBC or PDO_DBLIB drivers are the two options I would try.

    Comment

    • afroz ahmad
      New Member
      • Mar 2013
      • 18

      #3
      use

      mysql_connect(" dbname","userna me","password ")

      Comment

      • Atli
        Recognized Expert Expert
        • Nov 2006
        • 5062

        #4
        Originally posted by afroz ahmad
        use

        mysql_connect(" dbname","userna me","password ")
        1. He's asking about MSSQL (Microsoft SQL Server), not MySQL. Big difference.

        2. The old MySQL API extension, including the mysql_connect and mysql_query functions, is deprecated and should not be used any more. These days you should be using PDO or MySQLi to access MySQL.

        3. The old MSSQL functions, like mssql_connect(), are not available on PHP 5.3 or higher. The SqlSrv extension I mentioned in my previous post should be used instead.

        Comment

        Working...