Files
sql-server-samples/samples/tutorials/php/Ubuntu/SqlServerSample/connect.php
T

15 lines
345 B
PHP

<?php
// Setup the connection
$serverName = 'localhost';
$connectionOptions = [
'Database' => 'SampleDB',
'Uid' => 'sa',
'PWD' => 'your_password'
];
// Establish the connection
$connection = sqlsrv_connect($serverName, $connectionOptions);
if ($connection) {
echo 'Connected!';
}