Puedo colocar un if en while mientras imprime datos de BD
Publicado por Julio (2 intervenciones) el 16/01/2019 00:31:46
Me gustaria saber si hay alguna manera de colocar un if en while mientras imprime datos de BD
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
if ($resultado->num_rows > 0) {
$salida.="<table class='tabla_datos'>
<thead>
<tr>
<th colspan='8'>Lista de Clientes</th>
</tr>
</thead>
<tbody>
<tr>
<th>Nombre</th>
<th>Identificacion</th>
<th>Telefono</th>
<th>Sexo</th>
<th >N° Compras</th>
<th >Agregado</th>
<th>Actualizar</th>
<th >Eliminar</th>
</tr>
";
while ($fila= $resultado->fetch_assoc()) {
$salida.="<tr>
<td>".$fila['Nombre']."</td>
<td>".$fila['Identificacion']."</td>
<td>".$fila['Telefono']."</td>
<td>".$fila['Sexo']."</td>
<td >".$fila['Ncompras']."</td>
<td >".$fila['Fecha']."</td>
<td ><a href='actualizar_cliente.php?id=".$fila['id']."'></a></td>".
//ME GUSTARIA COLACAR EL IF AQUI, Y SEGUN SE CUMPLA LA CONDICION
IMPRIMA LA SIGUIENTE LINEA:
"<td ><a href='eliminar_cliente.php?id=" .$fila['id']."'></a></td>"
"</tr>";
}
$salida.="</tbody></table>";
Valora esta pregunta
0