alexa-tracking

[ASK] PHP Dengan SQL SERVER

Main Content

1024
1024
KASKUS
51
244
https://www.kaskus.co.id/thread/576b44a4dac13ec6128b456a/ask-php-dengan-sql-server
[ASK] PHP Dengan SQL SERVER
gan, tanya donk, lagi nyoba PHP dan SQL Server. tapi ko gagal terus ya dikoneksinya. apa ada yang salah ya.
Nih scriptnya
Code:

$host ="localhost:8080\MSSQLSERVER, 1433";
$opsi = array("Database"=>"namadatabasenya", "UID"=>"sa", "PWD"=>"password");
$con = sqlsrv_connect($host,$opsi);
if($con){
echo "Koneksi berhasil";
}else{
echo "server tidak bisa diakses<br /><br />";
die(print_r( sqlsrv_errors(), true));
}


errornya gini gan:
Quote:server tidak bisa diakses

Array ( [0] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 11004 [code] => 11004 [2] => [Microsoft][ODBC Driver 11 for SQL Server]TCP Provider: The requested name is valid, but no data of the requested type was found. [message] => [Microsoft][ODBC Driver 11 for SQL Server]TCP Provider: The requested name is valid, but no data of the requested type was found. ) [1] => Array ( [0] => HYT00 [SQLSTATE] => HYT00 [1] => 0 [code] => 0 [2] => [Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired [message] => [Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired ) [2] => Array ( [0] => 08001 [SQLSTATE] => 08001 [1] => 11004 [code] => 11004 [2] => [Microsoft][ODBC Driver 11 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. [message] => [Microsoft][ODBC Driver 11 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. ) )


Itu kenapa ya gan, mohon pencerahannya dah mentok euy. emoticon-Smilie
Coba ganti localhost:8080 dengan computer name