我如何使用mysql检查where where条件中的'Submitted'字符串

时间:2014-07-30 19:34:49

标签: mysql

 $result2 = mysql_query( "SELECT  COUNT(Station_Name) AS sab1 FROM complaint_tbl WHERE Station_Name='".$sname."' and 
    Complaint_Type='".$cmbType."' and cmpsubtype='".$cmpsub."' and crimeloc='".$cmploc."' and Status= 'Submited' ");    
     while($row=mysql_fetch_assoc($result2))
     {
             $size1 = $row['sab1'];
     }
      mysql_free_result($result2);

     echo "Crimes solved yet:";
     echo $size1;

在第53行的C:\ xampp \ htdocs \ Crime \ PoliceStation \ Canalysersubmit.php中始终显示错误,如“解析错误:语法错误,意外'提交'(T_STRING)” 如何使用mysql

检查字符串的状态

1 个答案:

答案 0 :(得分:0)

$SQL="SELECT COUNT(station_name)
        FROM complaint_tbl
       WHERE station_name='$sname'
         AND complaint_type='$cmbType'
         AND cmpsubtype='$cmpsub'
         AND crimeloc='$cmploc'
         AND status='Submited'";

//echo $SQL;

$rst=mysql_query($SQL);
$row=mysql_fetch_row($rst)
$size1=$row[0];

mysql_free_result($rst);

echo "Crimes solved yet:".$size1;