MSSQL and PHP

Discussion in 'HTML / PHP / JavaScript / CSS' started by Kira Yamato, Jan 18, 2011.

  1. Im getting an error when i try to connect to my database with php, this is my code:

    $serverName = "sql2k510.discountasp.net";
    $uid = "SQL2005_******_******_user";
    $pwd = "******";
    $databaseName = "SQL2005_******_******";

    $connectionInfo = array( "UID"=>$uid,
    "PWD"=>$pwd,
    "Database"=>$databaseName);

    /* Connect using SQL Server Authentication. */
    $conn = sqlsrv_connect( $serverName, $connectionInfo);

    /* Check the connection to be done */
    if ( $conn )
    {
    echo "Connection established.\n";
    }
    else
    {
    echo "Connection could not be established.\n";
    die( print_r( sqlsrv_errors(), true));
    }

    What is wrong with it?
     
  2. Actually the whole error is this:

    Connection could not be established. Array ( [0] => Array ( [0] => IM003 [SQLSTATE] => IM003 [1] => 160
    Code:
     => 160 [2] => Specified driver could not be loaded due to system error 14001 (SQL Server Native Client 10.0). [message] => Specified driver could not be loaded due to system error 14001 (SQL Server Native Client 10.0). ) )
     
  3. Joseph Jun

    Joseph Jun DiscountASP.NET Staff

    Do you know what web server your site is hosted on?
     
  4. You mean server name? it says web137
     
  5. Joseph Jun

    Joseph Jun DiscountASP.NET Staff

    It looks like there was a configuration issue on the server that was causing the problem which we've fixed, sorry about that.

    Can you try your script again to see if you can at least establish a connection and then execute a query?
     

Share This Page