小编Bog*_*tin的帖子

我的代码中出现MYSQL错误

我的代码中有这个erorr:

致命错误:不能重新声明search_results()(以前在一个声明:\ WAMP\WWW \包括\ func.inc.php:4)A:\ WAMP\WWW \包括第39行上调用堆栈\ func.inc.php

在那个文件中我有:

<?php

function search_results($keywords){
    $returned_results = array();
    $where = "";

    $keywords = preg_split('/[\s]+/',$keywords);
    $total_keywords = count($keywords);

        foreach($keywords as $key=>$keyword){
            $where .= "`article_content` LIKE '%$keyword%'";
                if($key != ($total_keywords - 1)){
                    $where .= " AND ";
                }
        }

    $results = "SELECT *  FROM `articles` WHERE $where";
    $results_num = ($results = mysql_query($results)) ? mysql_num_rows($results) : 0 ;
    if($results_num === 0){
        return false;
    }
    else{

        while($results_row = mysql_fetch_assoc($results)){
            $returned_results[] = array(

                    'article_title' =>$results_row['article_title'],
                    'article_content' =>$results_row['article_content'],
                    'article_timestamp' …
Run Code Online (Sandbox Code Playgroud)

php mysql

0
推荐指数
1
解决办法
45
查看次数

标签 统计

mysql ×1

php ×1