Utilizar if Else
Publicado por Enrique (43 intervenciones) el 07/03/2020 22:04:30
Estoy buscando insertar un else en el caso de que no haya ningun valor en el resultado de mi consulta pero no se como insertarlo, si alguien me pudiera apoyar
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
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="10"> </td>
<td height="20"> </td>
<td width="10"> </td>
</tr>
<tr>
<td> </td>
<td><h2><strong>Respuestas</strong></h2></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
<?php
$sql="SELECT * FROM preguntas WHERE idc = '$id' AND status = 'Respuesta'";
$result=mysqli_query($mysqli,$sql);
while($mostrar=mysqli_fetch_array($result)){
?>
<tr>
<td height="100" align="left" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td><strong><a href="<?php echo $mostrar['url'] ?>"><?php echo $mostrar['producto'] ?></a></strong></td>
</tr>
<tr>
<td><?php echo $mostrar['pregunta'] ?></td>
</tr>
<tr>
<td height="30" background="img/bckspace.jpg"><a href="answer.php?key=<?php echo $mostrar['id'] ?>"><img src="img/reply.jpg" width="100" height="22" alt=""/></a></td>
</tr>
</tbody>
</table>
</td>
</tr>
<?php
}
?>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr> </tr>
</table>
</td>
<td></td>
</tr>
</tbody>
</table>
Valora esta pregunta


0