I would like to add a select with information from the database and save it in a variable. Unfortunately it doesn't work for me, it just shows me one record and not all records.
$sql = $conn->query("SELECT * FROM recaudacionBancaria")
foreach ($sql as $key => $value) {
// class='theClass' value='".$value['cuenta']."'idCuenta='".$value['id']."'></div>";
$cuenta = "<div class='btn-group'><select class='form-control input-xs cue' name='cue' id='cue'>
<option>'".$value['cuenta']."'</option>
$cat= $conn->query("SELECT * FROM bancos");
foreach ($cat as $key => $val) {
'<option value="'.$val["cuenta"].'">'.$val["cuenta"].'</option>';
}
</select></div>";
echo '<tr>
<td>'.$value['subsistema'].'</td>
<td>'.$cajas.'</td>
</tr>';
$cat
is having all values or not ? and what is firstforloop
.foreach ($sql as $key => $value) {
while($row = $result->fetch_assoc()) {
this line is missing. w3schools.com/php/php_mysql_select.asp