if(isset($_GET["searchText"])) { $searchText = $_GET["searchText"]; $searchAddSql = $searchAddSql." and (book_number like '%".$searchText."%' or book_name like '%".$searchText."%' or book_sum like '%".$searchText."%' or book_author like '%".$searchText."%')"; }
//最开始的$news_sql = "SELECT * from books where 1=1 ".$searchAddSql." order by book_number ";就会变成:
$news_sql="SELECT * from books where 1=1 and (book_number like '%中%' or book_name like '%中%' or book_sum like '%中%' or book_author like '%中%' ) order by book_number";