I'm trying to put two conditions in the foreach, but I'm not having success. The idea is as follows: the client accesses the website at the following URL: / room / balcony and only products that have in their database in the DB the room environment and the category 'balcony' appear.
The code is the one I'm using
.htaccess
RewriteRule ^produtos/(.*)$ produtos.php?id=$1&cat=$2
Search page
$ProdAmb= $_GET['id'];
$ProdCat= $_GET['cat'];
$muda_path = explode('/', $ProdAmb);
$muda_path1 = explode('/', $ProdCat);
foreach($muda_path as $produto_link){
$ProdID = $produto_link;
$subcat = $sub;
$prod_select_categoria = "SELECT * FROM todos_produtos INNER JOIN ambiente_moveis ON ambiente_moveis.nome = todos_produtos.ambiente_prod INNER JOIN categorias_moveis ON categorias_moveis.nome = todos_produtos.categoria_prod WHERE categorias_moveis.link_cat='$subcat' OR ambiente_moveis.link_cat='$ProdID'";
$query = @mysql_query($prod_select_categoria) or die (mysql_error());
}
The 'all_products' table contains the two terms, environment and category, whereas the table 'environment_prod' only has environments and 'category_moveis' only has categories, both tables (environment and category) the structure are the same, changing only the data . As you know, foreach only has one condition, but I have already tried with & or || and none worked.