我试图测试此查询是否运行。但是我输出的是空白屏幕,即没有输出。我正在使用xampp服务器。当我尝试使用mysql_query()命令运行它时,查询未运行
<?php
$mysql_host='localhost';
$mysql_user='root';
$mysql_pass='';
$mysql_db='a_database';
$con_error='connection error';
$query="SELECT `name` FROM `users` WHERE `id`='1' "; //selecting name from databas where id is 1
$query_run=mysql_query($query); //this is my query
if($query_run)
{
echo 'success';
}
?>
请帮我这个。 $query_run
在这里既不返回false也不是true。我无法理解问题所在。
你建立你的数据库的连接。? –
您正在使用[an **过时的**数据库API](http://stackoverflow.com/q/12859942/19068)并应使用[现代替换](http://php.net/manual/en/) mysqlinfo.api.choosing.php)。 – Quentin