Hello.

I decided to try to connect the database from Microsoft and PHP.

Added necessary dll to ext

PHP code

<?php $conn = sqlsrv_connect("localhost\sqlexpress"); $sql = "SELECT Abonents.id FROM Abonents"; if ($conn) { echo "Connection established.\n"; $result = sqlsrv_query($conn, $sql); if( $result === false) { die( print_r( sqlsrv_errors(), true) ); } while( $row = sqlsrv_fetch_array( $result, SQLSRV_FETCH_ASSOC) ) { echo $row['id']."<br />"; } } else { echo "Connection could not be established.\n"; die(print_r(sqlsrv_errors(), true)); } sqlsrv_close($conn); ?> 

This is what I have in the browser

Connection established. Array ([0] => Array ([0] => 42S02 [SQLSTATE] => 42S02 [1] => 208 [code] => 208 [2] => [Microsoft] [SQL Server Native Client 11.0] [SQL Server] "Abonents". [Message] => [Microsoft] [SQL Server Native Client 11.0] [SQL Server] "Abonents".))

What to do with the encoding? (In PHP.ini something to change or in the code page) What does this error mean?

    1 answer 1

    Apparently, the base is not selected.

    The error message probably reports that the Abonents table was not found in the current database (master, most likely).