Ver Mensaje Individual
  #21 (permalink)  
Antiguo 26/02/2009, 09:26
rikimm
 
Fecha de Ingreso: agosto-2008
Ubicación: D,F
Mensajes: 412
Antigüedad: 15 años, 9 meses
Puntos: 4
Respuesta: no me funciona el update

bueno en fin pude resolver mi problema con la ayuda de triby que me tubo paciencia y me exploco bien para todos los que tengan las mima duda les dejo como quedo el codigo dinal y puedan resolver sus dudads y que les sirvaa de mucho estos son los codigos y tambien agradesco a los demas por sus opiniones y repusestas
en este te muestra los campos que vas a modificar
Código PHP:
<? include "encabezado.php" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<?
if(isset($_POST[enviar]))    
 {
$local="localhost";
$usuario="root";
$contraseña="";
$basededatos="aseco";
$conexion=mysql_connect($local,$usuario,$contraseña); // Conectar con MySQL
$dbmysql_select_db($basededatos,$conexion);
// $actual=date("y/m/d", filemtime("modificar_reportes.php")); 
print $fecha_entrega=date("y/m/d"); 
$busca=mysql_query("SELECT * FROM reportes WHERE  reporte like '%$busca%'  "); //Busqueda por medio de el campo reportes 
$control=$_POST["reportes"];
$row = @mysql_fetch_array($busca); 

$id_reporte=$row[0];
$nombres=$row[5];
$modelo=$row[4];
$reporte=$row[1];
$serie=$row[3];
$fecha=$row[2];
//$actual=$row[7];
$fecha_entrega=$row[7];
if(
mysql_num_rows($busca))
 {   
     
$datos=mysql_fetch_row($busca);
    echo 
"<!---/*<form name=formulario  action=cambiar.php method=POST >*/--->
    <form name=\"formulario\"  action=\"cambiar.php?id=$id_reporte\" method=\"POST\">
        <center><b>Modifica el formulario</b><br>
        <table>
        <tr><td>Nombre:</td> <td><input type='text' name='nombres' value='$nombres'  > <br></td></tr>
        <tr><td>Modelo:</td> <td><input type='text' name='modelo' value='$modelo' > <br></td></tr>
        <tr><td>Reporte:</td> <td><input type='text' name='reporte' value='$reporte'  > <br></td></tr>
        <tr><td>Serie:</td> <td><input type='text' name='serie' value='$serie'> <br></td></tr>
        <tr><td>Confirma Reporte: </td><td><input name='fecha_entrega' type='checkbox' value='$fecha_entrega' />
        <!--<tr><td>Fecha de Reporte:</td> <td><input type='text' name='fecha' value='$fecha'> <br></td></tr>-->
                <tr><td><input type='submit' value='enviarDatos' name='enviarDatos' /></td>
        <td><input name='regresar' value='Volver' type='button' onClick='javascript:history.go (-1)' /></tr>
                            </form></table></center>    "
;
 }
 else
  echo 
"No se encontro el Numero seleccionado";
          
}

else {
?>
<center>
<form name="cambios" action="modificar_reportes.php" method="POST">
Seleciona el numero de reporte: <input type="text" name="busca" /><br>
<input type="submit" value="enviar" name="enviar" />
<input name="cerrar" type="button" value="Cerrar" onClick="self.close()">
</form>
</center>

<?
}
?>

<body>
</body>
</html>
y el otro es este donde viene lo del update
Código PHP:
<? include "encabezado.php" ?>
<html>
<head><TITLE>Cambiar o Actualizar Registro</TITLE></head>
<body>
<?php
if (isset($_POST[enviarDatos]))
{
$local="localhost";
$usuario="root";
$contraseña="";
$basededatos="aseco";
$conexion=mysql_connect($local,$usuario,$contraseña); 
$dbmysql_select_db($basededatos,$conexion); //Archivo para conectar con MySQL
//date("y/m/d", filemtime("modificar_reportes.php"));
$id_reporte = (isset($_GET['id'])) ? $_GET['id'] * 0;
if(isset(
$_POST['fecha_entrega']))
$fecha_entrega="fecha_entrega ='" .date('Y-m-d'time()) . " ' ";
else
    
$fecha_entrega '';

/*print*/ $sql ="UPDATE reportes SET nombres='{$_POST['nombres']}' , modelo='{$_POST['modelo']}', reporte='{$_POST['reporte']}', serie='{$_POST['serie']}' , $fecha_entrega  WHERE id = $id_reporte ";
mysql_query($sql) or die (mysql_error());  
echo 
"<center>El registro se ha realizado satisfactoriamente<br><br> <b>Nombre:</b>".$nombres." <br> <b>Modelo:</b>".$modelo." <br> <b>No. de Reportes:</b>".$reporte."<br> <b>Serie:</b>".$serie."<br> <b>Fecha:</b>".$fecha_entrega."<br>  ";

}
?>
<center>Los cambios se han realizado satisfactoriamente<br>
<a href="modificar_reportes.php">Volver</a></center>
</body>
</html>