diff --git a/forum_search.php b/forum_search.php index bc36582..220462e 100644 --- a/forum_search.php +++ b/forum_search.php @@ -16,24 +16,25 @@ $type = getValue($_GET['type']); if ($type !== false) $type = (int)$type; $text = getvalue($_GET['text']); -$text = explode(' ', $text); $textTitleSql = ""; $textPostSql = ""; $textAuthorSql = ""; -for ($i = 0; $i < count($text); $i++) { - if ($i != count($text) -1) { - $textTitleSql .= "`title` LIKE '%". $text[$i] ."%' AND "; - $textPostSql .= "`text` LIKE '%". $text[$i] ."%' AND "; - $textAuthorSql .= "`player_name` LIKE '%". $text[$i] ."%' AND "; - } else { - $textTitleSql .= "`title` LIKE '%". $text[$i] ."%'"; - $textPostSql .= "`text` LIKE '%". $text[$i] ."%'"; - $textAuthorSql .= "`player_name` LIKE '%". $text[$i] ."%'"; +if ($text !== false) { + $text = explode(' ', $text); + for ($i = 0; $i < count($text); $i++) { + if ($i != count($text) -1) { + $textTitleSql .= "`title` LIKE '%". $text[$i] ."%' AND "; + $textPostSql .= "`text` LIKE '%". $text[$i] ."%' AND "; + $textAuthorSql .= "`player_name` LIKE '%". $text[$i] ."%' AND "; + } else { + $textTitleSql .= "`title` LIKE '%". $text[$i] ."%'"; + $textPostSql .= "`text` LIKE '%". $text[$i] ."%'"; + $textAuthorSql .= "`player_name` LIKE '%". $text[$i] ."%'"; + } } + //data_dump($text, array($textTitleSql, $textPostSql, $textAuthorSql), "search"); } -data_dump($text, array($textTitleSql, $textPostSql, $textAuthorSql), "search"); - ?>