【发布时间】:2014-07-26 18:38:34
【问题描述】:
我不断收到语法错误提示
Parse error: syntax error, unexpected '{' in C:\wamp\www\search.php on line 5
我查看了第 5 行,没有发现任何问题。我究竟做错了什么?
$result_tb = "";
if (!empty($_POST['SEARCH']) && !empty($_POST['search_value']) {
$e = $_POST['search_value'];
$query = 'SELECT * FROM register WHERE ' .
"first_name LIKE '%$e%' OR " .
"middle_name LIKE '%$e%' OR " .
"last_name LIKE '%$e%' OR " .
"login_name LIKE '%$e%' ";
$query_result = $mysqli_db->query($query);
$result_tb = '<table cellspacing="5" cellpadding="5">';
while ($rows = $query_result->fetch_assoc()) {
foreach ($rows as $k => $v) {
$result_tb .= '<tr><td>' . $k . '</td><td>' . $v . '</td></tr>';
}
}
$result_tb .='</table>';
$mysqli_db->close();
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Search</title>
</head>
<body>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<table>
<tr>
<td>
<input type="text" name="search_value" size="30" maxlength="30"/>
</td>
<td>
<input type="submit" name="SEARCH" value="Search"/>
</td>
</tr>
</table>
</form>
<?php echo $result_tb; ?>
</body>
</html>
【问题讨论】: