I'm a beginner in php and I'm developing a small system for my company that already serves as a study, because I really like this area, the question is simple, I have the following code:
<?php
include('conn/conexao.php');
$edt = $_GET['edital'];
$sql = "SELECT * FROM edt_cadastro WHERE id = $edt";
$res = $mysqli->query($sql);
$num = $res->num_rows;
for ($i = 0; $i < $num; $i++) {
$dados = $res->fetch_array();
$arrRefs[$dados['id']] = $dados['ref0'];
}
?>
<label>Referências:</label>
<select name="ref" id="ref">
<?php foreach($arrRefs as $value => $nome){
echo "<option value='{$value}'>{$nome}</option>";
}
?>
</select>
With this code it identifies the option of a previous select to load that select above (with jQuery), until it works right, only that the value that comes from the bank for this select, comes as an example array "1,2,3"
eu I would like it to show me a list with 1 then the 2, the 3 and so on, the bank is separated with comma "," (1,2,3) I already tried to use the explode option but then in the list only appears Last record in my example number 3. Could anyone help? Thank you