Почему выводит ошибку
Parse error: syntax error, unexpected 'search' (T_STRING), expecting ',' or ')' in C:\xampp\htdocs\search.php on line 31
<?php
function search($words) {
$words = htmlspecialchars($words);
if ($words === "" return false;
$query_search = "";
$arraywords = explode(" ", $words);
foreach($arraywords as $key => $value){
if (isset($arraywords[$key - 1]))
$query_search .= ' OR ';
$query_search .= '`title` LIKE "%'.$value.'%" OR `content` LIKE "%'.$value.'%"';
}
$query = "SELECT * FROM articles WHERE $query_search";
$mysqli = new mysqli("localhost", "blog", "", "articles');
$result_set = $mysqli->query($query);
$mysqli->close();
$i = 0;
while($row = $result_set->fetch_assoc()) {
$result[$i] = row;
$i++;
}
return $results;
}
if (isset($_POST[bsearch])) {
$words = $_POST[words];
$result = search($words);
print_r (result);
}
echo '
<html><head><title>ttt</title></head><body>
<form name="search"
action="search.php" method="post"><input type="text" name="words" placeholder="Введите текст..." /><input type="submit" name="bsearch" value="Поиск" /></form></body</html>';
?>
danchik2, $mysqli = new mysqli("localhost", "blog", "", "articles"
danchik2, print_r (result);
Замени на:
print_r($result);