代码之家  ›  专栏  ›  技术社区  ›  Mohammad

mysqli查询的php语法错误[duplicate]

  •  0
  • Mohammad  · 技术社区  · 8 年前

    我正在用php和mysql开发电子商务系统。

    运行应用程序时,出现以下错误:

    分析错误:语法错误,意外','在C:\wamp64\www\onlineordering\include\category.php的第10行**

    下面是category.php文件的代码:

    <div class="sidebar_box"><span class="bottom"></span>
        <h3>Categories</h3>   
        <div class="content"> 
            <ul class="sidebar_list">
                <?php
    
    
    
                $sqlCat= ("select * from category where recordstatus='' order by sequence_order Asc",$con);
                $exeCat = mysqli_query($sqlCat) or die ("Error in:sqlCat");
                $counCat= mysqli_num_rows($exeCat);
    

    这是我运行应用程序时的屏幕截图:

    enter image description here

    3 回复  |  直到 8 年前
        1
  •  2
  •   Rafid    8 年前

    那两行应该是

     $sqlCat= "select * from category where recordstatus='' order by sequence_order Asc";
     $exeCat = mysqli_query($con,$sqlCat) or die ("Error in:sqlCat");
    
        2
  •  2
  •   jaty muhammad    8 年前

    试试看。

    $sqlCat= "select * from category where recordstatus='' order by sequence_order Asc";
    $exeCat = mysqli_query($con,$sqlCat);
    

    $exeCat = mysqli_query($con,"select * from category where recordstatus='' order by sequence_order Asc");
    
        3
  •  1
  •   gview    8 年前

    您正在将字符串变量的赋值转换为某些不存在的函数调用。

    这是你的问题所在:

     $sqlCat= ("select * from category where recordstatus='' order by sequence_order Asc",$con);
    

    应该是:

     $sqlCat= "select * from category where recordstatus='' order by sequence_order Asc";
    

    您需要将$con变量移到mysqli_查询中它所属的位置。

    $exeCat = mysqli_query($con, $sqlCat) or die ("Error in:sqlCat");
    
    推荐文章