mysql_fetch_array()函数老是运行不成功,求解答

WBOY
Release: 2016-06-13 11:57:45
Original
1246 people have browsed it

mysql_fetch_array()函数总是运行不成功,求解答

include('../webshop_sql_con.php');
if(isset($_GET['search'])){
$search=$_GET['search'];
$query="SELECT  *  FROM  obj_info WHERE  obj_name LIKE '%search%' ORDER BY obj_sale DESC";
if ($result=mysql_query($query,$dbc)) {
         while ($row=mysql_fetch_array($result)) {
print'

  • '.$row['obj_name'].'

    价格:'.$row['obj_pri'].'

    ';
        
    }

    }
    数据库的连接文件写过了,其他的搜索都是这样写的 结果都可以返回,就这个总是不对  怎么回事呢,还有我试了 var_dump($row),结果是FALSE。。什么意思呢
    在做毕业设计,PHP也是刚刚接触的,麻烦大哥大姐们指教啊
    ------解决方案--------------------
    表中没有包含 search 字样的记录
    可能你需要的是
    $query="SELECT  *  FROM  obj_info WHERE  obj_name LIKE '%$search%' ORDER BY obj_sale DESC";
    ------解决方案--------------------
    同2楼 $query="SELECT  *  FROM  obj_info WHERE  obj_name LIKE '%$search%' ORDER BY obj_sale DESC";
    要细心啊
    ------解决方案--------------------
    同意2楼,拼接语句时要仔细啊
    ------解决方案--------------------
    sql写错了

  • 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