Dear I have a little problem soon it's something simple but I can not find the solution I hope one of you can save me.
I need to show products that have father and daughters categories and that when clicking on the father category I also show the products of their daughter categories but it only shows me the products of the daughter categories, for this I have two tables one of products and another of categories.
The product table has a category field that is the same id of the categories table. the category table has a parent field that by default has a value of 0, when it is a category daughter has the same value as the id of the parent category, that is, in the categories table, if the category man has the id 25 the category shirts that has the id 42 has the father 25 and in the table products the category field is 42, and I want you to bring me the products of id 25 and 42, I hope I did not make a mess.
I'm working with PHP and mysqli, please someone give me a hand. Thanks!
In sale 1, you show me the parent categories. In window 2 when choosing the FINISH category, you should show me all the products of your daughter categories. I have only managed to bring the name of those categories. In window 3 you should show only the products of the daughter category selected in this case ADDITIVES.
This is my query:
$query1 = mysqli_query($con,"select * from pam_categorias_catalogo where padre = $categoria and id_negocio = '$negocioid'")or die(mysqli_error($con));
while ($row = mysqli_fetch_array($query1)) {
$array[] = $row['padre'] ;
}
echo $array;
$query2 = mysqli_query($con,"select * from pam_catalogo where estado = '1' and id_negocio = '$negocioid' and categoria = $array")or die(mysqli_error($con));
$numero = mysqli_num_rows($query2);
if($numero == 0)
{
echo "Este negocio no tiene productos ingresados en su catalogo";
}
else
{