>我想在一个小.php中使用一个简单的SQL-Statment。但我的问题是我无法连接到服务器(MSSQL 2014)
错误:警告:mssql_connect() [function.mssql-connect]:无法连接到服务器:localhost''SQLEXPRESS in
法典:
<?php
$verbindung = mssql_connect('localhost'SQLEXPRESS', '*****', '*****');
if (!$verbindung || !mssql_select_db('php', $verbindung)) {
die('Connection Failed');
}
?>
我的系统:我使用 XAMPP 服务器 1.7.0 和 PHP 5.2.8
谢谢 4 你帮助:)
(您可能保留的拼写错误;P)
我认为您需要转义斜杠:
$verbindung = mssql_connect('localhost''SQLEXPRESS', '*****', '*****');
知道了
:D
$user = '*****';
$pass = '******';
$server = 'localhost'SQLEXPRESS';
$database = 'Account';
$connection_string = "DRIVER={SQL Server};SERVER=$server;DATABASE=$database";
$conn = odbc_connect($connection_string,$user,$pass);
if ($conn) {
echo "Connection established.";
} else{
die("Connection could not be established.");
}