Les cuento, tengo 2 problemas , estoy haciendo un select y un update en php, donde el select muestra todos los datos de la tabla que se encuentran en el phpmyadmin.
Mi primer problema es que inserte un boton editar en el select que muestra todo el contenido de la base de dato, le doy un click al boton y siempre me envia a la primera linea de la tabla.
Como puedo hacer para que sea independiente cada seccion.
El segundo problema es que el update me edita todo los campos de las tablas por ejemplo: quiero modificar el nombre y me cambia todos los nombres de la tabla, Como lo puedo hacer para que sea independiente cada seccion, sin alterar las demas?
Esperando su ayuda...
Este el el select:
y este es mi editor "UPDATE":
Mi primer problema es que inserte un boton editar en el select que muestra todo el contenido de la base de dato, le doy un click al boton y siempre me envia a la primera linea de la tabla.
Como puedo hacer para que sea independiente cada seccion.
El segundo problema es que el update me edita todo los campos de las tablas por ejemplo: quiero modificar el nombre y me cambia todos los nombres de la tabla, Como lo puedo hacer para que sea independiente cada seccion, sin alterar las demas?
Esperando su ayuda...
Este el el select:
Código:
<html>
<body>
<table border = '1'>
<tr>
<td><b>Nombre</b></td>
<td><b>rut</b></td>
<td><b>direccion</b></td>
<td><b>tipo</b></td>
<td><b>lugar</b></td>
<td><b>telefono</b></td>
<td><b>descripcion</b></td>
<td><b>ruta</b></td>
<td><b>editar</b></td>
</tr>
<?php
$con = mysql_connect("localhost","xxxxx","xxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("proyecto", $con);
$sql = mysql_query("SELECT nombre,rut,direccion,tipo,lugar,telefono,descripcion,ruta FROM propiedad" )
or die(mysql_error());
while ($row = mysql_fetch_array($sql)){
echo "<tr> \n";
echo "<td>$row[nombre]</td> \n";
echo "<td>$row[rut]</td> \n";
echo "<td>$row[direccion]</td> \n";
echo "<td>$row[tipo]</td> \n";
echo "<td>$row[lugar]</td> \n";
echo "<td>$row[telefono]</td> \n";
echo "<td>$row[descripcion]</td> \n";
echo "<td>$row[ruta]</td> \n";
[COLOR=#b22222]echo "<td><input type='button' value='editar' onclick=location.href='editardatospropiedad.php'></td>";[/COLOR]
echo "</tr> \n";
}
echo "<input type='submit' name='enviar' value='enviar datos'>"
?>
</body>
</html>
y este es mi editor "UPDATE":
Código:
<?php
$con = mysql_connect("localhost","xxxx","xxxxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("proyecto", $con);
$query1="select * from propiedad";
$resultado=mysql_query($query1);
$row=mysql_fetch_array($resultado)
?>
<html>
<head></head>
<body>
<center>
<h2> Modificar Datos </h2></center><br>
<form name='form1' method='post' action='editordedatos.php' type='form' >
<table border=0 align='center'>
<tr>
<td><strong>Nombre:</td><br>
<td><br></strong><input type='text'name='nombre' size=20 maxlength='40' value= <?php echo "$row[nombre]"; ?>>
<br><br></td> </tr>
<tr>
<td><strong>rut:</td>
<td><br></strong><input type='text'name='rut' size=20 maxlength='40' value= <?php echo "$row[rut]"; ?>>
<br><br></td> </tr>
<tr>
<td><strong>direccion:</td>
<td><br></strong><input type='text'name='direccion' size=20 maxlength='40' value= <?php echo "$row[direccion]"; ?>>
<br><br></td> </tr>
<tr>
<td><strong>Tipo:</td>
<td><br></strong><input type='text' name='tipo' size=20 maxlength='40' value= <?php echo "$row[tipo]"; ?>>
<br><br></td> </tr>
<td><strong>Lugar:</td>
<td><br></strong><input type='text'name='lugar' size=20 maxlength='40' value= <?php echo "$row[lugar]"; ?>>
<br><br></td> </tr>
<td><strong>Telefono:</td>
<td><br></strong><input type='text' name='telefono' size=20 maxlength='40' value= <?php echo "$row[telefono]"; ?>>
<br><br></td> </tr>
<td><strong>Descripcion:</td>
<td><br></strong><input type='text' name='descripcion' size=20 maxlength='40' value= <?php echo "$row[descripcion]"; ?>>
<br><br></td> </tr>
<tr>
<td></strong><input type='submit' values="Enviar" size='15' maxlength='10'> </td>
<td><input type="reset" value="Borrar"></td>
<br><br> </tr>
</table>
</form>
</BODY>
</HTML>