php - PHP 上的 MSSQL 连接错误

标签 php mysql sql sql-server xampp

我想在一个小的 .php 中使用一个简单的 SQL 语句。 但我的问题是我无法连接到服务器(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-Server 1.7.0 和 PHP 5.2.8

感谢 4 你的帮助:)

(您可能会保留拼写错误;P)

最佳答案

我认为你需要转义斜杠:

$verbindung = mssql_connect('localhost\\SQLEXPRESS', '*****', '*****');

关于php - PHP 上的 MSSQL 连接错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36008083/

相关文章:

php - 接受包含多点系统的值

php - Access-Control-Allow-Origin 未出现在 codeigniter 的响应 header 中

php - "Notice: Undefined variable"、 "Notice: Undefined index"、 "Warning: Undefined array key"和 "Notice: Undefined offset"使用 PHP

mysql - mysql查询中的汇总信息列

java.sql.SQLException : Access denied for user 'userx' @'%' (using password: YES)

php - 查询 Laravel Eloquent 关系

mysql - SQL搜索结果排名

mysql - 如何在不创建索引的情况下检索 MySQL 中的列选择性元数据?

从一个表中的特定组中选择 MIN 的 SQL 更新

php - php 页面中的查询不起作用