hibrydpachi
Bovino maduro
- Desde
- 16 Nov 2008
- Mensajes
- 274
- Tema Autor
- #1
Hola amigos weno toy programando una aplicacion en la uni
y necesito hacer una consulta
toy manejando php y msql
qiero en un html mediante un form y una caja de texto insertar un valor sobre el cual se hara la consulta encontre codigos en internet pero no me corren ojala puedan ayudarme
me urge
aqi el codigo del html
<html>
<head>
<title>CONSULTA</title>
<head>
</head>
<body>
<form action="consulta.php" method="post">
<BR><BR><BR>
<center>
<table border=5>
<tr>
<td>Cedula</td>
<td><input name="caja1" size="18" value= ""></td>
</tr>
<TR>
<TD><input type=SUBMIT name=BOTON2 value ="Consultar"></TD>
<TD><input type=RESET name=BOTON1 value ="Borrar"></TD>
</TR>
</table>
</center>
</form>
</body>
</html>
aqi el codigo del php
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
</HEAD>
<BODY>
<?
$link = mysql_connect("localhost", "root", "");
mysql_select_db("cav",$link);
$sql = "select * from usuarios where id_usuario = '".mysql_escape_string($_POST['caja1'])."'";
$sql = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($sql))
{
echo "clave: ".$row['id_usuario']."<br>";
echo "nombre: ".$row['nombre']."<br>";
echo "nombre de usuario: ".$row['nombre_usuario']."<br>";
echo "pasword: ".$row['pass']."<br>";
echo "tipo".$row['tipo']."<br>";
}
?>
</BODY>
</HTML>
y necesito hacer una consulta
toy manejando php y msql
qiero en un html mediante un form y una caja de texto insertar un valor sobre el cual se hara la consulta encontre codigos en internet pero no me corren ojala puedan ayudarme
me urge
aqi el codigo del html
<html>
<head>
<title>CONSULTA</title>
<head>
</head>
<body>
<form action="consulta.php" method="post">
<BR><BR><BR>
<center>
<table border=5>
<tr>
<td>Cedula</td>
<td><input name="caja1" size="18" value= ""></td>
</tr>
<TR>
<TD><input type=SUBMIT name=BOTON2 value ="Consultar"></TD>
<TD><input type=RESET name=BOTON1 value ="Borrar"></TD>
</TR>
</table>
</center>
</form>
</body>
</html>
aqi el codigo del php
<HTML>
<HEAD>
<TITLE>New Document</TITLE>
</HEAD>
<BODY>
<?
$link = mysql_connect("localhost", "root", "");
mysql_select_db("cav",$link);
$sql = "select * from usuarios where id_usuario = '".mysql_escape_string($_POST['caja1'])."'";
$sql = mysql_query($sql) or die(mysql_error());
while($row = mysql_fetch_array($sql))
{
echo "clave: ".$row['id_usuario']."<br>";
echo "nombre: ".$row['nombre']."<br>";
echo "nombre de usuario: ".$row['nombre_usuario']."<br>";
echo "pasword: ".$row['pass']."<br>";
echo "tipo".$row['tipo']."<br>";
}
?>
</BODY>
</HTML>