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

WBOY
Release: 2016-06-23 13:50:23
Original
1198 people have browsed it

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();


数据库表名写错。真悲剧
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!