PHP与Mysqli查询中的语法错误

时间:2018-07-03 01:38:29

标签: php mysqli

我正在使用php和mysql开发e start系统。

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

  

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

这是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 个答案:

答案 0 :(得分:2)

这2行应该是

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

答案 1 :(得分:2)

尝试一下。

$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");

答案 2 :(得分:1)

您正在将字符串变量的分配转换为某种类型的不存在的函数调用。

这是您的问题所在行:

 $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_query。

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