Help me please! I can not understand why the data is not displayed on the screen! PhpDesigner 8 does not see a syntactic error, and the browser does not give the same error, but does not want to give the result of the search anyway. What to do?

Here is the html form:

<html> <head> <title>Test</title> </head> <body> <form name="search" action="index.php" method="post"> <input type="text" name="words"/> <input type="submit" name="bsearch" value="поиск"/> </form> </body> </html> 

Here is the index.php form:

 <?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 .= ' description LIKE "%'.$value.'%" OR title LIKE "%'.$value.'%"'; } $query = "SELECT * FROM riskyjobs WHERE $query_search"; $dbc = mysqli_connect ('localhost', '', '', '') or die ('ошибка соединения с MySQL-сервером'); $result_set = $dbc->query($query); mysqli_close($dbc); $i = 0; while($row = $result_set->fetch_assoc()) { $results[$i] = $row; $i++; } return $results; } if (isset($_POST['bsearch'])) { $words = $_POST['words']; $results = search($words); print_r($results); } ?> 
  • one
    You use the procedural mysqli style. and here $ dbc-> query ($ query); - object. Use some one - mountpoint
  • Still not working! Although I changed $ mysqli = new mysqli, $ result_set = $ mysqli-> query ($ query); $ mysqli-> close (); Anyway, the request is sent as if in a void! - Arty21

0