У меня есть эта опция поиска, где она ищет заголовок и категорию, ссылающуюся на переменную, запрошенную ФОРМОЙ.
//This could be Reference or Product Name
$name = mysqli_real_escape_string($con, sanitize($_GET['search']));
//this could be a specific category or Empty(used to reference number)
$category = mysqli_real_escape_string($con, sanitize($_GET['category']));
$x = 0;
$q = str_replace(array("\\",";"), "", $name); // remove ALL backslashes & remove ALL ";" -> for sql security: no (simple) injection of commands
$q = trim($q);
$search_exploded = explode(" ", $q);
foreach($search_exploded as $search_each ) {
$x++;
if($x == 1) {
$wherearr[]= "ads_title LIKE '%$search_each%' AND category_id = '$category' AND ads_active = 1 AND ads_end = 0";
} else {
$wherearr[]= "ads_title LIKE '%$search_each%' AND category_id = '$category' AND ads_active = 1 AND ads_end = 0";
}
}
//$wherearr[] is used to create a new variable $construct to insert to SQL like "Select * from Where $construct"
Я хочу, чтобы люди могли искать также по ссылке.
Цель состоит в том, чтобы, когда человек вставит ссылку, он автоматически перейдет к продукту.
Добавить это поле:
$wherearr[]= "ads_reference LIKE '%$search_each%' AND ads_active = 1 AND ads_end = 0";
Как я могу сделать это, используя форму, которую я создал ранее?