Ayuda boton consulta en PHP
Publicado por Nelson (29 intervenciones) el 28/03/2017 19:02:37
Buenos días amablemente solicito de su colaboración,
Tengo un formulario necesito crear un boton de consultar cuanto materiales a intercambiado un usuario, copio codigo, pero cuando le doy consultar no me muestra nada,
Gracias
Tengo un formulario necesito crear un boton de consultar cuanto materiales a intercambiado un usuario, copio codigo, pero cuando le doy consultar no me muestra nada,
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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Documento sin título</title>
</head>
<body>
</table>
<h1><div align="center"> <font size="5"><b> CONSULTA CONTIDAD DE TRUEQUES REALIZADOS </b></div></h1>
<body>
<form name="consulta" method="post" action="">
<td>Numero de documento</td>
<td><input type="text" name="codigo" maxlength="4">
<td><input type="submit" name="Enviando" id="enviando" value="Consultar"> </td>
</form>
<table width="45%" align="center">
</table>
<?php
if (isset($_POST["numerodocumento"])) {
$link = mysql_connect('localhost','root','') or die('No se pudo conectar: ' . mysql_error());
//echo 'Connected successfully';
mysql_select_db('bdprueba') or die('No se pudo seleccionar la base de datos');
$query="select tipodocumento, numerodocumento, nombre, cantidadLibros FROM tbusuarios where numerodocumento='".$_POST['numerodocumento']."'";
$result = mysql_query($query) or die('Consulta fallida: ' . mysql_error());
$cantidad=0;
echo "<table>";
while($row = mysql_fetch_row($result)) {
echo "<tr>";
echo "<td>";
echo "Tipo de documento : ";
echo "</td>";
echo "<td>";
echo $row['tipodocumento'];
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo "Número de documento :";
echo "</td>";
echo "<td>";
echo $row['numerodocumento'];
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo "Nombre completo : ";
echo "</td>";
echo "<td>";
echo utf8_encode($row['nombre']);
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo "Cantidad libros : ";
echo "</td>";
echo "<td>";
echo $row['cantidadLibros'];
echo "</td>";
echo "</tr>";
$cantidad=$cantidad+$row['cantidadLibros'];
}
echo "</table><br>";
echo "Cantidad de libros :" . $cantidad ;
}
?>
</body>
</html>
Valora esta pregunta


0