fixed warning if text is false.

This commit is contained in:
Stefan Brannfjell 2013-08-31 13:38:40 +02:00
parent 3082c27bc8
commit af09b01f59

View File

@ -16,24 +16,25 @@ $type = getValue($_GET['type']);
if ($type !== false) $type = (int)$type; if ($type !== false) $type = (int)$type;
$text = getvalue($_GET['text']); $text = getvalue($_GET['text']);
$text = explode(' ', $text);
$textTitleSql = ""; $textTitleSql = "";
$textPostSql = ""; $textPostSql = "";
$textAuthorSql = ""; $textAuthorSql = "";
for ($i = 0; $i < count($text); $i++) { if ($text !== false) {
if ($i != count($text) -1) { $text = explode(' ', $text);
$textTitleSql .= "`title` LIKE '%". $text[$i] ."%' AND "; for ($i = 0; $i < count($text); $i++) {
$textPostSql .= "`text` LIKE '%". $text[$i] ."%' AND "; if ($i != count($text) -1) {
$textAuthorSql .= "`player_name` LIKE '%". $text[$i] ."%' AND "; $textTitleSql .= "`title` LIKE '%". $text[$i] ."%' AND ";
} else { $textPostSql .= "`text` LIKE '%". $text[$i] ."%' AND ";
$textTitleSql .= "`title` LIKE '%". $text[$i] ."%'"; $textAuthorSql .= "`player_name` LIKE '%". $text[$i] ."%' AND ";
$textPostSql .= "`text` LIKE '%". $text[$i] ."%'"; } else {
$textAuthorSql .= "`player_name` LIKE '%". $text[$i] ."%'"; $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");
?> ?>
<h1>Search forum</h1> <h1>Search forum</h1>
<form method="" type="get"> <form method="" type="get">
@ -204,4 +205,5 @@ if ($type !== false && $text !== false && $type <= 4 || $type > 4 && $type <= 6)
} else echo "No results."; } else echo "No results.";
} else echo "<br><b>You must fill in all fields!</b>"; } else echo "<br><b>You must fill in all fields!</b>";
include 'layout/overall/footer.php'; ?> include 'layout/overall/footer.php';
?>