PDOException'带消息'SQLSTATE [HY000]:常规错误:1191

时间:2017-02-01 04:11:17

标签: php mysql pdo

<?php
if(isset($_POST['searchQuery'])) {
    require_once('config.inc.php');
    $search_query=$_POST['searchQuery'];
    $sql = 'SELECT * from sanct where MATCH(Name,State,Catagory) AGAINST(:search_query)';
    $statement = $connection->prepare($sql);
    $statement->bindParam(':search_query', $search_query, PDO::PARAM_STR);
    $statement->execute();
    if($statement->rowCount()) {
        $row_all = $statement->fetchall(PDO::FETCH_ASSOC);
        header('Content-type: application/json');
        echo json_encode($row_all);
    } elseif(!$statement->rowCount()) {
        echo "no rows";
    }
}  
?>

0 个答案:

没有答案