PHP - Duplicado de datos en un select

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

Duplicado de datos en un select

Publicado por Benito (11 intervenciones) el 16/05/2019 00:53:54
Hola buenas tardes tengo un problema en uno de mis select resulta que los datos que ingrese en la base de datos se me duplican en mi select pero no se el porque alguien podria asesorarme en ese tema

adjunto mi codigo

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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?php
	include 'db.php';
	$query="SELECT id, personal FROM alta";
	$resultado=mysqli_query($conexion,$query);
 ?>
 
<!DOCTYPE html>
<html lang="es">
<head>
	<meta charset="UTF-8">
	<title>Fromulario Prueba</title>
	<link rel="stylesheet" type="text/css" href="resources/General.css">
	<link rel="icon" type="image/png" sizes="16x16" href="resources/eon16x16.png">
 
</head>
<body>
	<section class="main">
	<header>
		<div class="cabecera">
		<img src="resources/EON.jpg" width="100px">
		<h1>REPORTE DE ACTIVIDADES</h1><br><br>
		<h2>Engineering and Optimization Network</p>
		<a href="reportes.php">Vista de Reportes</a>
		</div>
	</header>
 
		<p><span>* </span>Obligatorio</p>
 
		<form class="listar" action="enviar.php" method="POST" >
			<label class="verde"> <label class="azul">1</label> <br>Personal <span>*</span></label>
 
			<!--select name="personal"-->
			<select type="text" class="form-control" style="height: 40px;padding-left: 5px;" name="personal" id="personal" required>
 
 		<option value="">Seleccione personal </option>
 
                    <?php
 
					while($alta=mysqli_fetch_array($resultado)){
 
                    ?>
                            <option value="<?php echo $alta['personal']?>"> <?php echo $alta['personal']?> </option>
                    <?php
                        }
                    ?>
			<!--select required autofocus>
				<option>Selecciona la respuesta</option>
				  <option value="Isabel Posadas">Isabel Posadas</option>
                  <option value="Emilio Ramirez">Emilio Ramirez</option>
                  <option value="Luciano Perez">Luciano Perez</option>
                  <option value="Emmanuel Zamudio">Emmanuel Zamudio</option-->
			</select>
 
			<label class="verde"> <label class="azul">1.1</label> <br>Area <span>*</span></label>
			<select type="text" class="form-control" style="height: 40px;padding-left: 5px;" name="area" id="area" required>
 
     <option value="">Seleccione un area </option>
     <option value="Administracion">Administracion</option>
     <option value="PLC">PLC</option>
     <option value="Eléctrica">Eléctrica</option>
     <option value="Robótica">Robótica</option>
     <option value="Diseño Mecánico">Diseño Mecánico</option>
     <option value="Tecnologias de la información">Tecnologias de la información</option>
      <option value="Proyectos">Proyectos</option>
            </select>
 
			<label class="verde"> <label class="azul">2</label> <br>ID del proyecto <span>*</span></label>
			<input type="text" name="idproyecto" placeholder="Escribe numero de proyecto" id="idproyecto" required autofocus>
 
			<label class="verde"> <label class="azul">3</label> <br>Fecha <span>*</span></label>
			<input type="date" name ='fecha' placeholder="Escribe fecha " id='fecha' required autofocus/>
			<!--input type="fecha" name="fecha" placeholder="Escribe fecha en formato DD/MM/YY" id="fecha" required autofocus-->
 
			<label class="verde"> <label class="azul">4</label> <br>Lugar <span>*</span><br>Oficina/Nombre de planta</label>
			<input type="text" name="lugar" placeholder="Escribe tu respuesta" id="lugar" required autofocus>
 
			<label class="verde"> <label class="azul">5</label> <br>Actividad <span>*</span><br>Obligatorio</label>
			<input type="text" name="actividad1" placeholder="Escribe tu respuesta" id="actividad1" required autofocus>
 
			<label class="verde"> <label class="azul">6</label> <br>Tiempo Actividad 1 (00:00:00) <span>*</span><br>Obligatorio</label>
			<input type="text" name="tiempo1" placeholder="Escribe tiempo" id="tiempo1" required autofocus>
 
 
 
<!-- ----------------------------------------------------------------------------------------- -->
			<label class="verde"> <label class="azul">7</label> <br>Avance Actividad 1<span>*</span><br>Obligatorio</label>
			<table>
			<tr>
				<th><label class="radio">1</label></th>
				<th><label class="radio">2</label></th>
				<th><label class="radio">3</label></th>
				<th><label class="radio">4</label></th>
				<th><label class="radio">5</label></th>
				<th><label class="radio">6</label></th>
				<th><label class="radio">7</label></th>
				<th><label class="radio">8</label></th>
				<th><label class="radio">9</label></th>
				<th><label class="radio">10</label></th>
			</tr>
			<tr>
			<td><input type="radio" name="avance1" id="avance1" value="1" required></td>
			<td><input type="radio" name="avance1" id="avance1" value="2" required></td>
			<td><input type="radio" name="avance1" id="avance1" value="3" required></td>
			<td><input type="radio" name="avance1" id="avance1" value="4" required></td>
			<td><input type="radio" name="avance1" id="avance1" value="5" required></td>
			<td><input type="radio" name="avance1" id="avance1" value="6" required></td>
			<td><input type="radio" name="avance1" id="avance1" value="7" required></td>
			<td><input type="radio" name="avance1" id="avance1" value="8" required></td>
			<td><input type="radio" name="avance1" id="avance1" value="9" required></td>
			<td><input type="radio" name="avance1" id="avance1" value="10" required></td>
			</tr>
			</table>
<!-- ----------------------------------------------------------------------------------------- -->
			<label class="verde"> <label class="azul">8</label> <br>Actividad 2<br>(Respuesta Opcional)</label>
			<input type="text" name="actividad2" placeholder="Escribe tu respuesta" id="actividad2"  >
 
			<label class="verde"> <label class="azul">9</label> <br>Tiempo Actividad 2 (minutos)<br>(Respuesta Opcional)</label>
			<input type="text" name="tiempo2" placeholder="Escribe tiempo" min="1" id="tiempo2"  >
 
			<label class="verde"> <label class="azul">10</label> <br>Avance Actividad 2<br>(Respuesta Opcional)</label>
			<table>
			<tr>
				<th><label class="radio">1</label></th>
				<th><label class="radio">2</label></th>
				<th><label class="radio">3</label></th>
				<th><label class="radio">4</label></th>
				<th><label class="radio">5</label></th>
				<th><label class="radio">6</label></th>
				<th><label class="radio">7</label></th>
				<th><label class="radio">8</label></th>
				<th><label class="radio">9</label></th>
				<th><label class="radio">10</label></th>
			</tr>
			<tr>
			<td><input type="radio" name="avance2" id="avance2" value="1"></td>
			<td><input type="radio" name="avance2" id="avance2" value="2"></td>
			<td><input type="radio" name="avance2" id="avance2" value="3"></td>
			<td><input type="radio" name="avance2" id="avance2" value="4"></td>
			<td><input type="radio" name="avance2" id="avance2" value="5"></td>
			<td><input type="radio" name="avance2" id="avance2" value="6"></td>
			<td><input type="radio" name="avance2" id="avance2" value="7"></td>
			<td><input type="radio" name="avance2" id="avance2" value="8"></td>
			<td><input type="radio" name="avance2" id="avance2" value="9"></td>
			<td><input type="radio" name="avance2" id="avance2" value="10"></td>
			</tr>
			</table>
<!-- ----------------------------------------------------------------------------------------- -->
			<label class="verde"> <label class="azul">11</label> <br>Actividad 3<br>(Respuesta Opcional)</label>
			<input type="text" name="actividad3" placeholder="Escribe tu respuesta" id="actividad3"  >
 
			<label class="verde"> <label class="azul">12</label> <br>Tiempo Actividad 3 (minutos)<br>(Respuesta Opcional)</label>
			<input type="text" name="tiempo3" placeholder="Escribe tiempo" min="1" id="tiempo3"  >
 
			<label class="verde"> <label class="azul">13</label> <br>Avance Actividad 3<br>(Respuesta Opcional)</label>
			<table>
			<tr>
				<th><label class="radio">1</label></th>
				<th><label class="radio">2</label></th>
				<th><label class="radio">3</label></th>
				<th><label class="radio">4</label></th>
				<th><label class="radio">5</label></th>
				<th><label class="radio">6</label></th>
				<th><label class="radio">7</label></th>
				<th><label class="radio">8</label></th>
				<th><label class="radio">9</label></th>
				<th><label class="radio">10</label></th>
			</tr>
			<tr>
			<td><input type="radio" name="avance3" id="avance3" value="1"></td>
			<td><input type="radio" name="avance3" id="avance3" value="2"></td>
			<td><input type="radio" name="avance3" id="avance3" value="3"></td>
			<td><input type="radio" name="avance3" id="avance3" value="4"></td>
			<td><input type="radio" name="avance3" id="avance3" value="5"></td>
			<td><input type="radio" name="avance3" id="avance3" value="6"></td>
			<td><input type="radio" name="avance3" id="avance3" value="7"></td>
			<td><input type="radio" name="avance3" id="avance3" value="8"></td>
			<td><input type="radio" name="avance3" id="avance3" value="9"></td>
			<td><input type="radio" name="avance3" id="avance3" value="10"></td>
			</tr>
			</table>
<!-- ----------------------------------------------------------------------------------------- -->
			<label class="verde"> <label class="azul">14</label> <br>Otras actividades<br>(respuesta opcional)</label>
			<input type="text" name="otras" placeholder="Escribe tu respuesta" id="otras"  >
 
			<label class="verde"> <label class="azul">15</label> <br>Planificación<br>del día siguiente</label>
			<input type="text" name="planificacion" placeholder="Escribe tu respuesta" id="planificacion"  >
 
			<input type="submit" name="enviar" value="Enviar">
 
 
 
		</form>
 
		<footer>
			<p>EON 2019</p>
		</footer>
 
	</section>
 
	<script type="text/javascript" src="resources/jquery.js"></script>
 
	<script type="text/javascript" src="resources/inputs.js"></script>
 
</body>
 
<!--https://forms.office.com/Pages/ResponsePage.aspx?id=x8fjOlHq3kaVQBL0EQ6sm2Q_3nJ70jtKoeMUfE2iFgtUN0YzRjJKVEdGVkcyUDNTUjlQMkZMODFTUi4u-->
</html>
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
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Duplicado de datos en un select

Publicado por xve (6935 intervenciones) el 16/05/2019 07:54:08
A simple vista parece que esta correcto... has revisado que realmente no estén duplicados en la base de datos?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
1
Comentar
Imágen de perfil de Mauro
Val: 2.761
Oro
Ha aumentado 1 puesto en PHP (en relación al último mes)
Gráfica de PHP

Duplicado de datos en un select

Publicado por Mauro (1036 intervenciones) el 16/05/2019 14:55:14
En caso de que efectivamente estén duplicados puedes hacer un SELECT usando DISTINCT:

1
SELECT DISTINCT id, personal FROM alta

Aunque, si los duplicados no deberían existir, lo mejor es poner un índice único y ver dónde el programa está generando el problema
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar