I'm trying to accommodate the value from a MySQL table to PHP, I am using HTML code but I am not sure how to show the values.
Here is my code:
$codigoHTML= '<table width="100%" border="1" class="table table-
hover">';
$consultaSucursales = "SELECT id,empresa FROM empresa";
$ejecutar = mysql_query($consultaSucursales);
while($fila = mysql_fetch_array($ejecutar))
{
$codigoHTML.= '<td><strong><center>'.$fila['empresa'].'</center></strong></td>';
$respuesta = datos($fila['id']);
$codigoHTML.= $respuesta;
}
$codigoHTML.='
</tbody>
</table>';
echo $codigoHTML;
function datos($id_sucursal)
{
$consultaCantidades = "SELECT cantidad FROM producto WHERE id_sucursal = '$id_sucursal'";
$ejecutar2 = mysql_query($consultaCantidades);
$codigoHTML2 = "";
while($fila2 = mysql_fetch_array($ejecutar2))
{
$codigoHTML2.= '<tr>';
$codigoHTML2.= '<td>'.$fila2['cantidad'].'</td>';
$codigoHTML2.= '</tr>';
}
return $codigoHTML2;
}