Home >Backend Development >PHP Tutorial >php 连上数据库之后出现Call to undefined function mssql_query()?

php 连上数据库之后出现Call to undefined function mssql_query()?

WBOY
WBOYOriginal
2016-06-06 20:18:001176browse

<code><?php include("conn/conn.php");
$online_number=$_POST[online_number];
$online_pass=$_POST[online_pass];

$query=mssql_query("select * from tb_user where online_number='"."$online_number"."' and online_pass='$online_pass'");
if(mssql_num_rows($query)>0){
session_register(online_number);
echo "<script> alert('登录成功!'); window.location.href='index.php?online=进入考场';</script>";
}else{
echo "登录失败!";
}
?></code>
<code>$con=@mysql_connect('localhost','root','root') ;
if($con)
{
    echo "连接45成功";
}</code>

php 连上数据库之后出现Call to undefined function mssql_query()?

我买了一本php项目开发实战密码 于广/编著 太坑爹了。

浏览器提示 Call to undefined function mssql_query() denglu_ok.php on line 5 ?

回复内容:

<code><?php include("conn/conn.php");
$online_number=$_POST[online_number];
$online_pass=$_POST[online_pass];

$query=mssql_query("select * from tb_user where online_number='"."$online_number"."' and online_pass='$online_pass'");
if(mssql_num_rows($query)>0){
session_register(online_number);
echo "<script> alert('登录成功!'); window.location.href='index.php?online=进入考场';</script>";
}else{
echo "登录失败!";
}
?></code>
<code>$con=@mysql_connect('localhost','root','root') ;
if($con)
{
    echo "连接45成功";
}</code>

php 连上数据库之后出现Call to undefined function mssql_query()?

我买了一本php项目开发实战密码 于广/编著 太坑爹了。

浏览器提示 Call to undefined function mssql_query() denglu_ok.php on line 5 ?

1.mysql_query()
2.别用mysql_connect了,php.net mysql_connect

Note:
本扩展自 PHP 5.5.0 起已废弃,并在将来会被移除。应使用 MySQLi 或 PDO_MySQL 扩展来替换之。参见 MySQL:选择 API 指南以及相关 FAQ 以获取更多信息。用以替代本函数的有:

<code>mysqli_connect()
PDO::__construct()
</code>

mysql_query(),不是mssql_query()你没有定义mssql_query()当然无法调用。

<code>Call to undefined function mssql_query()?</code>

调用未定义的函数报错,应改为mysql_query()

哥哥,你截图的是mysql,函数却调用mssql,后者是sqlserver的

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn