Home  >  Article  >  Backend Development  >  php 总是查询数据失败,到底哪里错了

php 总是查询数据失败,到底哪里错了

WBOY
WBOYOriginal
2016-06-23 13:50:231190browse

function ax($que)
{
    if(!$connect)
    {
        $connect = mysql_connect(‘localhost’,'axmanage','axmanpw');
        mysql_select_db('dex',$connect);  //这里是连接成功的,但是查询总是失败。
        $query = mysql_query($que); //这一句失败。
        if(!$query)
        {
         echo '查询失败';
        }else{
           echo '查询成功';
        }

    }
}
ax('select * from datak where fimx =1');


回复讨论(解决方案)

echo mysql_error();

把你的SQL语句复制一遍在命令行中运行,就知道错误在哪里了

echo mysql_error();


数据库表名写错。真悲剧
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
Previous article:帮忙解释两个for循环Next article:日志文件问题