
problema al crear un buscador para mysql
Publicado por deivy (1 intervención) el 29/05/2016 22:23:57
el problema es en el if por que la parte del else lo realiza pero al introducir un valor para validar el if y que realice la función no hace nada , agradecería mucho la ayuda
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
<!--tabla buscar-->
<table border="4" cellspacing="7" cellpadding="1" width="15%" style="position:absolute;top:194px;left:999px;">
<tr>
<td><center><b><font color=#FFF8DC>Codifgo Producto</font></b></td></center>
<td><input type="texto" name="Cod_Producto"/></td>
<td colspan"1"><center><input type="submit" name="Cod_Producto" value="Buscar" /></td></center>
</tr>
</table>
<!--tablaMostrar-->
<table bgcolor="#C0C0C0" border="4" cellspacing="7" cellpadding="1" width="55%" style="position:absolute;top:311px;left:294px;">
<tr>
<td><b><font color=#000000>Codigo Producto</font></b></font></td>
<td><b><font color=#000000>Descriccion</font></b></td>
<td><b><font color=#000000>Precio</font></b></td>
<td><b><font color=#000000>En Existencia</font></b></td>
<td><b><font color=#000000>Codigo Proveedor</font></b></td>
</tr>
<?php
if(!empty($_POST['Cod_Producto']) ){
require ("C:\wamp\www\Proyecto\TABLA.php");
$resultado=mysql_query("SELECT * FROM productos WHERE Cod_Producto LIKE '%'$_POST[Cod_Producto]'%'",$link);
while($row=mysql_fetch_array($resultado)){
?>
<tr>
<td><b><font color=#000000><?php echo $row['Cod_Producto'];?></font></b></td>
<td><b><font color=#000000><?php echo $row['Des_Producto'];?></font></b></td>
<td><b><font color=#000000><?php echo $row['Precio'];?></font></b></td>
<td><b><font color=#000000><?php echo $row['Existencia'];?></font></b></td>
<td><b><font color=#000000><?php echo $row['Cod_proveedor'];?></font></b></td>
</tr>
<?php
} }else{
require ("C:\wamp\www\Proyecto\TABLA.php");
$resultado=mysql_query("SELECT * FROM productos",$link);
while($row=mysql_fetch_array($resultado)){
?>
<tr>
<td><b><font color=#000000><?php echo $row['Cod_Producto'];?></font></b></td>
<td><b><font color=#000000><?php echo $row['Des_Producto'];?></font></b></td>
<td><b><font color=#000000><?php echo $row['Precio'];?></font></b></td>
<td><b><font color=#000000><?php echo $row['Existencia'];?></font></b></td>
<td><b><font color=#000000><?php echo $row['Cod_proveedor'];?></font></b></td>
</tr>
<?php
} }
?></table><tr>
Valora esta pregunta


0