I have a website in 3 languages. PT-EN-ES. The customer always registers the information in PT first. Then q it ADD the other languages.
DUVIDA:
In the control panel you have the option to ADD these other 2 languages as in the image Database
id|produto_id|idioma1|522|12|522|23|522|3
Language:PT=1,EN=2andES=3
WhenIregister,theID1istheoneIregistered.Ineedtoregistertheother2.
HowtomakeaselectinthebanktogetwhatIregistered?
Product(suchID)withtheLANGUAGE(such)
HowtodothisselectUSINGPDO
Andifyoudonothavethelanguageregistered,theregistrationbuttonappears,ifyouhaveregistered,abuttontoeditandtheothertodelete
FollowthecodeI'musing
<?phpif($listar->rowCount($dados->idioma)<2){?><td><ahref="painel.php?p=produtos-idiomas-cadastrar&cod=<?php echo $dados->id_produto; ?>&img=<?php echo $dados->produto_imagem; ?>&cat=<?php echo $dados->categoria; ?>&idioma=2">
<button type="submit" class="btn btn-success"><i class="fa fa-plus"></i> Cadastrar</button>
</a>
</td>
<?php } else {
$listar2 = $pdo->prepare("SELECT * FROM produtos WHERE ativo = 1 AND id_produto = :cod AND idioma = 2");
$listar2->bindParam(':cod', $cod);
$listar2->execute();
$dados2 = $listar2->fetch(PDO::FETCH_OBJ);
?>
<td>
<a href="painel.php?p=produtos-idioma-editar&cod=<?php echo $dados2->id;?>"><span class="glyphicon glyphicon-pencil" aria-hidden="true" title="Editar"></span></a> <a href="produtos-deletar.php?cod=<?php echo $dados2->id;?>"><span class="glyphicon glyphicon-remove" aria-hidden="true" title="Editar"></span></a>
</td>
<?php } ?>
I do the same thing with ES by changing only idioma para 3
.