modificacion en php
Publicado por francisco (2 intervenciones) el 22/10/2007 16:38:09
quiero una ayuda para modificar en php tengo tres partes la cual la primera es donde busco por medio de la cedula los datos la segunda me los muestra para modificar y la tercera me la valida para modificar y guardar el error me lo da en donde dice registros y no se porq quien me puede ayudar aki les dejo los codifgos fuentes:
modificacion1.php
<html>
<head></head>
<body>
<form id="f1" name="f1" action="modificacion2.php" method="post">
<table border="1">
<tr>
<td colspan="2"> Suministre Cedula </td>
</tr>
<tr>
<td> Cedula </td>
<td> <input type="text" name="ced" id="ced"> </td>
</td>
<tr>
<td colspan="2"> <input type="submit" id="b1" name="b1" > <input type="reset" id="b2" name="b2"> </td>
</tr>
</table>
</form>
</body>
</html>
modificacion2.php
<html>
<head></head>
<body>
<form id="f2" name="f2" action="modificacion3.php" method="post">
<table border="1">
<tr>
<td colspan="2"> Actualize Sus Datos </td>
</tr>
<?php
$ced=$_POST['ced'];
$con=mysql_connect("localhost","root");
if ($con)
{
$sql="select * from tablas.cobros where ced='".$ced."'";
$registros=mysql_query($sql,$con);
if ($registros)
{
$filas=mysql_num_rows($registros);
if ($filas>0)
{
$arreglo=mysql_fetch_row($registros);
?>
<tr>
<td> Verifica La Cedula </td>
<td><input type="text" id="ced" name="ced" value="<?php echo($arreglo[0])?>"></td>
</tr>
<tr>
<td> Verifica La Fecha </td>
<td><input type="text" id="fec" name="fec" value="<?php echo($arreglo[1])?>"></td>
</tr>
<tr>
<td> Verifique El Monto </td>
<td><input type="text" id="mon" name="mon" value="<?php echo($arreglo[2])?>"></td>
</tr>
<tr>
<td> Verifique El Estado </td>
<td><input type="text" id="edo" name="edo" value="<?php echo($arreglo[3])?>"></td>
</tr>
<?php
}
else
{
?>
<tr>
<td colspan="2"> No Se Encontro El Registro </td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td colspan="2"> No Se Conecto A La Tabla </td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td colspan="2"> No Se Conecto Al Servidor </td>
</tr>
<?php
}
?>
<tr>
<td colspan="2"> <input type="submit" id="b1" name="b1" value="Emviar"> <input type="reset" id="b2" name="b2" value="Limpiar"> <input type="button" value="Otra Consulta" id="b3" name="b3" onClick="document.location='modificacion1.php'"> </td>
</tr>
</table>
</form>
</body>
</html>
modificacion3.php
<html>
<head></head>
<body>
<?php
$ced=$_POST['ced'];
$fec=$_POST['fec'];
$mon=$_POST['mon'];
$edo=$_POST['edo'];
$con=mysql_connect("localhost","root");
if ($con)
{
$sql="update tablas.cobros set cedula='".$ced."',fecha='".$fec."',monto='".$mon."',estado='".$edo."' where cedula='".$ced."'";
$registros=mysql_query($sql,$con);
if (registros)
{
$filas=mysql_affected_rows($con);
if ($filas>0)
{
?>
<p> Se Actualizo El Registro Con Exito </p>
<?php
}
else
{
?>
<p> No Se Actualizo El Registro </p>
<?php
}
}
else
{
?>
<p> No Se Conecto A La Tabla </p>
<?php
}
}
else
{
?>
<p> No Se Conecto Al Servidor </p>
<?php
}
?>
<p> <input type="button" value="Otra Modificacion" onClick="document.location='modificacion1.php'"> </p>
</body>
</html>
modificacion1.php
<html>
<head></head>
<body>
<form id="f1" name="f1" action="modificacion2.php" method="post">
<table border="1">
<tr>
<td colspan="2"> Suministre Cedula </td>
</tr>
<tr>
<td> Cedula </td>
<td> <input type="text" name="ced" id="ced"> </td>
</td>
<tr>
<td colspan="2"> <input type="submit" id="b1" name="b1" > <input type="reset" id="b2" name="b2"> </td>
</tr>
</table>
</form>
</body>
</html>
modificacion2.php
<html>
<head></head>
<body>
<form id="f2" name="f2" action="modificacion3.php" method="post">
<table border="1">
<tr>
<td colspan="2"> Actualize Sus Datos </td>
</tr>
<?php
$ced=$_POST['ced'];
$con=mysql_connect("localhost","root");
if ($con)
{
$sql="select * from tablas.cobros where ced='".$ced."'";
$registros=mysql_query($sql,$con);
if ($registros)
{
$filas=mysql_num_rows($registros);
if ($filas>0)
{
$arreglo=mysql_fetch_row($registros);
?>
<tr>
<td> Verifica La Cedula </td>
<td><input type="text" id="ced" name="ced" value="<?php echo($arreglo[0])?>"></td>
</tr>
<tr>
<td> Verifica La Fecha </td>
<td><input type="text" id="fec" name="fec" value="<?php echo($arreglo[1])?>"></td>
</tr>
<tr>
<td> Verifique El Monto </td>
<td><input type="text" id="mon" name="mon" value="<?php echo($arreglo[2])?>"></td>
</tr>
<tr>
<td> Verifique El Estado </td>
<td><input type="text" id="edo" name="edo" value="<?php echo($arreglo[3])?>"></td>
</tr>
<?php
}
else
{
?>
<tr>
<td colspan="2"> No Se Encontro El Registro </td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td colspan="2"> No Se Conecto A La Tabla </td>
</tr>
<?php
}
}
else
{
?>
<tr>
<td colspan="2"> No Se Conecto Al Servidor </td>
</tr>
<?php
}
?>
<tr>
<td colspan="2"> <input type="submit" id="b1" name="b1" value="Emviar"> <input type="reset" id="b2" name="b2" value="Limpiar"> <input type="button" value="Otra Consulta" id="b3" name="b3" onClick="document.location='modificacion1.php'"> </td>
</tr>
</table>
</form>
</body>
</html>
modificacion3.php
<html>
<head></head>
<body>
<?php
$ced=$_POST['ced'];
$fec=$_POST['fec'];
$mon=$_POST['mon'];
$edo=$_POST['edo'];
$con=mysql_connect("localhost","root");
if ($con)
{
$sql="update tablas.cobros set cedula='".$ced."',fecha='".$fec."',monto='".$mon."',estado='".$edo."' where cedula='".$ced."'";
$registros=mysql_query($sql,$con);
if (registros)
{
$filas=mysql_affected_rows($con);
if ($filas>0)
{
?>
<p> Se Actualizo El Registro Con Exito </p>
<?php
}
else
{
?>
<p> No Se Actualizo El Registro </p>
<?php
}
}
else
{
?>
<p> No Se Conecto A La Tabla </p>
<?php
}
}
else
{
?>
<p> No Se Conecto Al Servidor </p>
<?php
}
?>
<p> <input type="button" value="Otra Modificacion" onClick="document.location='modificacion1.php'"> </p>
</body>
</html>
Valora esta pregunta


0