PHP - PROBLEMA CON CONSULTA MYSQL PHP

 
Vista:
sin imagen de perfil
Val: 14
Ha aumentado su posición en 15 puestos en PHP (en relación al último mes)
Gráfica de PHP

PROBLEMA CON CONSULTA MYSQL PHP

Publicado por Leandro (15 intervenciones) el 08/12/2018 22:17:57
Actualmente estoy teniendo un pequeño problemita. Estoy haciendo un pequeño sistema de loterias y estoy modelando el Ticket que recibira el cliente, como se ve en la siguiente imagen:

1

Mi problema es que quiero obtener los valores de los numeros jugados en este ticket y agruparlos de 2 en 2 celdas por NRO y MONTO para ahorrar espacio en el ticket, pero al momento de hacer la consulta, me devuelve los valores duplicados. A continuacion les muestro una imagen de como deberia verse en teoria. Esta imagen es editada:


2XX

Mi codigo es el siguiente:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
$findLoterias = mysql_query("SELECT loteria FROM tabla_loterias WHERE ticket = '$cod' GROUP BY loteria");
 
    while($ss = mysql_fetch_assoc($findLoterias)){
    $infoLoteria = mysql_fetch_assoc(mysql_query("SELECT * FROM loterias WHERE grupo='".$infoTaquilla[grupo]."' and nombre_abreviado ='".$ss[loteria]."'"));
 
?>
 
<tr>
    <td colspan="4">===============================</td>
</tr>
<tr height="20" style="color:;border-bottom:1px solid black;font-weight: bold;">
    <td colspan="4" style="font-size:12px;font-weight: bold;text-align: center;"><?php echo $infoLoteria[nombre].' - '.date("l d/m"); ?></td>
</tr>
<tr>
    <td colspan="4">===============================</td>
</tr>
<tr height="25" style="font-size:12px;">
    <th style="width:25%;">NRO</th>
    <th style="width:25%;">MONTO</th>
    <th style="width:25%;">NRO</th>
    <th style="width:25%;">MONTO</th>
</tr>
<tr>
    <td colspan="4">===============================</td>
</tr>
 
<?php
    $picks = mysql_query("SELECT * FROM tabla_loterias WHERE ticket='$cod' and loteria = '".$ss[loteria]."'");
    $count = 0;
    while($ssx = mysql_fetch_assoc($picks)){
        $count = $count + 1;
 ?>
<tr height="25" style="color:;border-bottom:1px solid black;font-weight: bold;font-size: 12px;">
    <td><center><?php echo $ssx[numero]; ?></center></td>
    <td style="text-align: right;padding-right:5px;"><?php echo $ssx[monto]; ?></td>
    <td><center><?php echo $ssx[numero]; ?></center></td>
    <td style="text-align: right;padding-right:5px;"><?php echo $ssx[monto]; ?></td>
</tr>
<?php }} ?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
1
Responder