note 118003 deleted from reserved.variables.get by cmb
| From: | cmb@php.net | Date: | Tue, 15 Dec 2015 15:26:10 +0000 |
| Subject: | note 118003 deleted from reserved.variables.get by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-204365@lists.php.net to get a copy of this message | ||
Note Submitter: Tolulope
----
pls i need help on how to make my code work for search engine.
<?php
//connect server and database here
//then below is the set command and query
if(isset($_GET['search'])) {
$search_value= $_GET['value'];
$query = "select * from sites where keywords like '%search_value'";
$my_run = mysql_query($query);
while ($row = mysql_fetch_array($my_run)) {
$title =$row['title'];
$link =$row['link'];
$desc =$row['description'];
echo "<h1>$title</h1><a href=
'$link'>$link</a><p>$desc</p>";
}
}
?>
Error : but it keeps telling me that i can make use of global array $_GET , that i should instead
use filter_input.
Now i set up my filter_input code like this but still did not search my database to return result .
but it gave no error. please i need help.
if(!empty(INPUT_GET ('search'))){
$search_value = filter_input(INPUT_GET, 'value');
$query = "select * from sites where keywords like '%search_value'";
$my_run = mysql_query($query);
while ($row = mysql_fetch_array($my_run)) {
$title =$row['title'];
$link =$row['link'];
$desc =$row['description'];
echo "<h1>$title</h1><a href=
'$link'>$link</a><p>$desc</p>";
}
}
?>