Ahoj, mám takový probém a potřebuji poradit.
<?php
$search = $_GET['search'];
$terms = explode(" ", $search);
$query = "SELECT * FROM tab WHERE ";
foreach ($terms as $each) {
$i++;
if ($i == 1)
$query .= "keywords LIKE '%$each%' ";
else
$query .= "keywords LIKE '%$each%' ";
}
include "script/connect_to_mysql.php";
$query = mysql_query($query);
$numrows = mysql_num_rows($query);
if ($numrows > 0) {
while ($row = mysql_fetch_assoc($query)){
$id = $row['id'];
$product_name = $row['product_name'];
$keywords = $row['keywords'];
$results .= '<p>' . $product_name . '</p>';
}
}
else
echo "Nic";
mysql_close();
?>
a v HTML mám normálně <?php echo $results; ?>
a píše mi to chyby
Notice: Undefined variable: i in C:\xampp\htdocs\IQdroid\search.php on line 6
Notice: Undefined variable: results in C:\xampp\htdocs\IQdroid\search.php on line 23
Poradíte prosím?