PHP - Obtener el valor menor que no se repite

 
Vista:
sin imagen de perfil

Obtener el valor menor que no se repite

Publicado por Carlos (1 intervención) el 15/12/2014 05:02:54
Buen día colegas, tengo una tabla donde muestro 10 valores por n cantidad de usuarios, lo que deseo es obtener el numero menor y el que no se repita de esos valores: Por ejemplo:

Marcos 1
Luis 0
Luis 1
Marcos 3
Luis 0
José 4

El número menor que no se repite es el 3, por lo tanto, en otra tabla en la misma página, debe mostrar

Resultado: Marcos 3

acá el código de la table principal donde se muestran los valores obtenidos de la base de datos, de antemano muchas gracias

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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<table id="tab_customers" cellspacing="0" class="tablesorter" width="200" >
 
	      <tr>
	        <th><h2>Nombre</h2></th>
	        <th><h2>N&uacute;meros</h2></th>
          </tr>
 
 
	      <tr><?php do { ?>
	        <td><h3><?php echo $row_rifa['nombre']; ?></h3></td>
	        <td><h3>
              <?php
$a=$row_rifa['d1'];
$b=$row_rifa['d2'];
$c=$row_rifa['d3'];
$d=$row_rifa['d4'];
$e=$row_rifa['d5'];
$f=$row_rifa['d6'];
$g=$row_rifa['d7'];
$h=$row_rifa['d8'];
$i=$row_rifa['d9'];
$j=$row_rifa['d0'];
$flag=false;
$numeros= array ("num1"=>$a,"num2"=>$b,"num3"=>$c,"num4"=>$d,"num5"=>$e,"num6"=>$f,"num7"=>$g,"num8"=>$h,"num9"=>$i,"num10"=>$j);
 
 
 
if (!$flag)
{
 
sort($numeros);
$a0=($numeros[0]);
$a1=($numeros[1]);
$a2=($numeros[2]);
$a3=($numeros[3]);
$a4=($numeros[4]);
$a5=($numeros[5]);
$a6=($numeros[6]);
$a7=($numeros[7]);
$a8=($numeros[8]);
$a9=($numeros[9]);
$numero= array ("nu1"=>$a0,"nu2"=>$a1,"nu3"=>$a2,"nu4"=>$a3,"nu5"=>$a4,"nu6"=>$a5,"nu7"=>$a6,"nu8"=>$a7,"nu9"=>$a8,"nu10"=>$a9);
 
echo $a0;
}
?>
            </h3></td>
          </tr>
          <tr>
            <td><h3><?php echo $row_rifa['nombre']; ?></h3></td>
            <td><h3>
              <?php
 
echo $a1;
 
 
?>
            </h3></td>
          </tr>
          <tr>
            <td><h3><?php echo $row_rifa['nombre']; ?></h3></td>
            <td><h3>
              <?php
 
echo $a2;
 
 
?>
            </h3></td>
          </tr>
          <tr>
            <td><h3><?php echo $row_rifa['nombre']; ?></h3></td>
            <td><h3>
              <?php
echo $a3;
 
 
?>
            </h3></td>
          </tr>
          <tr>
            <td><h3><?php echo $row_rifa['nombre']; ?></h3></td>
            <td><h3>
              <?php
echo $a4;
 
 
?>
            </h3></td>
          </tr>
          <tr>
            <td><h3><?php echo $row_rifa['nombre']; ?></h3></td>
            <td><h3>
              <?php
 
echo $a5;
 
 
?>
            </h3></td>
          </tr>
          <tr>
            <td><h3><?php echo $row_rifa['nombre']; ?></h3></td>
            <td><h3>
              <?php
 
echo $a6;
 
 
?>
            </h3></td>
          </tr>
          <tr>
            <td><h3><?php echo $row_rifa['nombre']; ?></h3></td>
            <td><h3>
              <?php
 
echo $a7;
 
 
?>
            </h3></td>
          </tr>
          <tr>
            <td><h3><?php echo $row_rifa['nombre']; ?></h3></td>
            <td><h3>
              <?php
 
echo $a8;
 
 
?>
            </h3></td>
          </tr>
          <tr>
            <td><h3><?php echo $row_rifa['nombre']; ?></h3></td>
            <td><h3>
              <?php
 
echo $a9;
 
?>
            </h3></td>
        </tr><?php } while ($row_rifa = mysql_fetch_assoc($rifa)); ?>
 
  </table>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder