Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/04/2004, 13:14
heyruben
 
Fecha de Ingreso: enero-2004
Mensajes: 339
Antigüedad: 20 años, 2 meses
Puntos: 6
Error en consulta

Sabia que escribir Urgente no me iba a resultar pero me parece espectacular la idea de la "retroayuda"
Este es mi problema, no se mucho de php tengo que hacer una simple consulta a una base de datos

<html>

<head>
<title>Sacrip</title>
</head>

<body bgcolor="#DCE2E6">

<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="750" height="529" bgcolor="#DCE2E6">
<tr>
</tr>
<tr>
<td width="775" colspan="2" height="19" bgcolor="#88C6D5">
</td>
</tr>
<tr>
<td width="177" height="277">&nbsp;</td>
<td width="573" height="277">

<form method="POST" action="http://localhost/sacrip.php">
<strong>Cedula: </strong> <input type="text" name="T1" size="9"><br><br>
<input type="submit" value="buscar" name="Consultar">
</td>
</tr>
<tr>
<td width="775" colspan="2" height="47">&nbsp;</td>
</tr>
</table>
</center>
</div>

</body>
</html>

y este es en php que copie de un usuario de este foro


<html>

<head>
<title>Sacrip</title>
</head>

<body bgcolor="#DCE2E6">

<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="750" height="529" bgcolor="#DCE2E6">
<tr>
</tr>
<tr>
<td width="775" colspan="2" height="19" bgcolor="#88C6D5"></td>
</tr>
<tr>
<td width="177" height="277">&nbsp;</td>
<td width="573" height="277">

<?php
if (!isset($buscar)){
echo "Debe especificar una cadena a buscar";
echo "</html></body> \n";
exit;
}
$link = mysql_connect("localhost", "");
mysql_select_db("sacrip", $link);
$result = mysql_query("SELECT * FROM mensualidad WHERE cedula=$T1 ORDER BY cedula", $link);
if ($row = mysql_fetch_array($result)){

echo "<table border = '1'> \n";
//Mostramos los nombres de las tablas
echo "<tr> \n";
while ($field = mysql_fetch_field($result)){
echo "<td>$field->name</td> \n";

}
echo "</tr> \n";
do {
echo "<tr> \n";
echo "<td>".$row["cedula"]."</td> \n";
echo "<td>".$row["nombre"]."</td> \n";
echo "<td>".$row["fecha"]."</td> \n";
echo "<td>".$row["monto"]."</a></td> \n";
echo "</tr> \n";
} while ($row = mysql_fetch_array($result));
echo "</table> \n";
} else {
echo "¡ No se ha encontrado ningún registro !";
}
?>
</td>
</tr>
</table>
</center>
</div>

</body>
</html>


creo que el error es tonto pero el que no sabe es como el que no ve y yo no lo veo
cuando busco mi cedula que es la unica que esta registrado y es la clave primaria me aparece el mj:
echo "Debe especificar una cadena a bucar";
por que?