I'm working on a project with phonegap, so I work in javascript, html and css environment and working this data externally with PHP and MYSQL. I have a search engine made by ajax and that everything is perfect, it shows me what I'm looking for correctly, but the problem is that it only searches for me by name, and I would like it to search for me by name and other data, such as the brand of the product. .
Imagine that it is Milk Whole the name, and the brand is Hacendado, because when introducing Leche Entera Hacendado appeared, at the moment it only works looking for Whole Milk.
The text entered sends it via ajax to the php file of the server, and it returns the data.
The PHP is this:
<?php
include "db.php";
$keyword=htmlspecialchars($_GET["search"]);
$data=array();
$q=mysqli_query($con,"SELECT products.product_name,brands.brand_name,products.product_price,products.product_size,products.product_image FROM products,brands WHERE brands.brand_id=products.product_brand and products.product_name LIKE '%$keyword%' and brands.brand_name LIMIT 5");
while ($row=mysqli_fetch_object($q)){
$data[]=$row;
}
echo json_encode($data);
?>
Thanks in advance!