我正在尝试使用php为我的数据库组建一个搜索栏,我遇到了这个问题,即使我的所有括号都已关闭。 这是我的表单页面:
<?php
require_once('connect.php');
$output = '';
if(isset($_POST['search'])) {
$searchq = $_POST['search'];
$searchq = preg_replace("#[^a-z]#i", "", $searchq);
$query = mysql_query("SELECT * FROM newclient WHERE first_name LIKE '%$searchq%' OR last_name LIKE '%$searchq%'") or die("Could not search!");
$count = mysql_num_rows($query) ;
if ($count == 0) {
$output = "There was no search result!";
}
else{
while ($row = mysql_fetch_array($query)){
$fname = $row['firstname'];
$lname = $row['lastname'];
$id = $row['id'];
$output .= '<div>'.$fname.' '.$lname.'</div>';
}
}
print("$output");
?>
这是我的search.php的php代码
MyTargetRange.Copy