I have the following Table in the database, I want to retrieve it to generate a report:
I'm recovering it with the following function statement in php:
#BUSCAR CAJA Y BOLSAS
public function todoReporteModel($datos, $tabla){
$stmt = Conexion::conectar() -> prepare("SELECT bolsa, caja FROM $tabla WHERE lote=:lotes");
$stmt -> bindParam(":lotes", $datos["loteAll"], PDO::PARAM_INT);
$stmt->execute();
return $stmt -> fetchAll();
$stmt->close();
}
The answer I get is the following:
My query is:
How can I order when I receive the answer, so that the values of the bags are grouped in each box, depending on the number of boxes? For example:
caja1=[1,2,3,40];
caja2=[89,78,968,125,963];
caja0=[10];