Notice: Undefined offset: 2 in C: \ wamp64 \ www \ angelamodas \ adm \ panel \ pages \ editProduct.php on line 103

0

I'm getting this error when I try to edit the selected colors in my database, I have three tables in my data pool = Products, colors and product colors The colors that were selected for such a product appear without problems but those that were not selected return with this error

  

Notice: Undefined offset: 4 in C: \ wamp64 \ www \ angelamodas \ adm \ panel \ pages \ editProduct.php on line 103

<label><spanclass="title">Selecione as cores disponíveis para este produto</span>
    <?php
    $sel_rel_cor = BD::conn()->prepare("SELECT * FROM 'loja_produto_cores' WHERE 
    id_produto = ?");
           $sel_rel_cor->execute(array($idProduto));
           $arr_cor = array();
           while($ftCor = $sel_rel_cor->fetchObject()){
                $arr_cor [$ftCor->id_cor] = $ftCor->id_cor;
           }
    $selecionar_cores = BD::conn()->prepare("SELECT * FROM 'loja_cores' ORDER BY 
    id DESC");
           $selecionar_cores->execute();
           while($dadosCores = $selecionar_cores->fetchObject()){
               $id = $dadosCores -> id;
          ?>
linha 103 -><input type="checkbox" name="cores[]" <?php if($id == $arr_cor 
    [$id]){ echo 'checked';}?> ) value="<?php echo $dadosCores->id;?>"/><?php 
    echo $dadosCores->cor;?>
    <?php }?>
    </label>
    
asked by anonymous 23.02.2018 / 12:17

0 answers