Help me out!
$BuscaProdutosAtivos = $pdo->prepare("SELECT * FROM tbl_produtos p
INNER JOIN tbl_categorias c ON c.cat_id = p.prod_categoria
INNER JOIN tbl_variacoes v ON v.cod_prod = p.id
WHERE p.prod_ativo = 1");
////////////////////////////////
$BuscaProdutosAtivos->execute();
$BuscaProdutosAtivos->rowCount();
I'm looking for 3 types of information within the database: first I look for a product that is active to show in the store, so far so good.
Then I look for the category that this product belongs to and everything is fine too.
My product can be green, yellow or blue and this is what I look for in the tbl_variacoes
table and I try to put it inside a dropdown and this is where I have problem because it returns only the first variation, ie only the first color.
while($PA = $BuscaProdutosAtivos->fetch()){ ?>
<select name="variacoes" class="form-control chosen-select" data-placeholder="Escolha a variação">
<option value=""></option>
<option value="1"><?=$PA['cor']?></option>
</select>
?>
How do I return all variations within the dropdown?
This code returns all base products that meet the requirements. If you can help to understand !!!!