I just make a connection to my database in my remote SQL Server, but unfortunately I got this error.
Constant expression contains invalid operations in public $conn = sqlsrv_connect( $serverName, $connectionInfo);
Here is my code:
<?php
class Database{
//specify database credentials
private $serverName = "siber.com\\sqldeveloper, 1433"; //serverName\instanceName, portNumber (default is 1433)
private $connectionInfo = array( "Database"=>"api_db", "UID"=>"SA", "PWD"=>"SiberCorshinee1123");
public $conn = sqlsrv_connect( $serverName, $connectionInfo);
public function getConnection(){
$this->conn = null;
}
?>
siber.com\\sqldeveloper
" doesn't seem like the right name for a SQL Server instance. – Larnu