像操作员不工作

时间:2018-05-15 12:53:32

标签: php mysql sql-like

我在使用PHP搜索时遇到问题。 我无法从我搜索的数据库中获取数据, 我无法在代码中发现任何问题。 信息:两个代码都在同一页面中。

HTML:

<form action="articles.php" method="POST">
  <input type="text" name="search" placeholder="..." class="form-control">
  <button type="submit" name="search_for_article_admincp" class="btn btn-default">Search</button>
</form>

PHP:

if(isset($_POST['search_for_article_admincp'])) {
    $search = trim($_POST['search']);
    $search_for_article_admincp=$db->prepare("SELECT * FROM `articles` WHERE name LIKE :search OR content LIKE :search LIMIT $display,$limit");
    $search_for_article_admincp->bindValue("search","%search%",PDO::PARAM_STR);
    $search_for_article_admincp->execute(); $list = $search_for_article_admincp->fetchAll(PDO::FETCH_ASSOC);
    foreach ($list as $article) { ?> 
        DATAS / HTML CONTENT 
        <?php 
     } 
} 

&GT;

0 个答案:

没有答案