SQL Server php mssql_select_db error

Until yesterday, I happily connected to SQL Server Express 2005 using PHP 5 on IIS 7.

Yesterday I started getting errors when choosing a database.

<?php
$link = mssql_connect('localhost,1433', 'login', 'password');

if(!$link) {
    die('could not connect to MSSQL');
}

 if(!mssql_select_db('database', $link)) {
    echo mssql_get_last_message();
    die('could not select db');    
}    
?>

Outputs the following:

" Changed database context to" database. Failed to select db "

So, mssql_get_last_messageoutput Changed database context to 'database'.that seems correct and is not really an error message. But then mssql_select_db still does not work.

I tested the following:

  • The login is correct (you get another error by changing the username or password)
  • The database exists (you get a different error if I use the name of the database that does not exist
  • ( , SQL Server)

, .

+3
1

. , .

+1

Source: https://habr.com/ru/post/1767340/


All Articles