Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/07/2015, 18:34
Avatar de xfxstudios
xfxstudios
 
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: Actualizar Registro con php y mysqli

Código PHP:
Ver original
  1. este es el codigo
  2. [HIGHLIGHT="PHP"]
  3. if($_POST['prorroga']=="")
  4. {
  5.     $prorroga = "No Aplica";
  6. } else {
  7.     $prorroga = $_POST['prorroga'];
  8. }
  9. if($_POST['si_no']=="Si"){
  10.     $cumple = "Cumple";
  11. }else {
  12.     $cumple = "No Cumple";
  13. }
  14. $id = $_POST['id'];
  15. $rif = $_POST['rif'];
  16. $unidad = $_POST['unidad'];
  17. $empresa = $_POST['empresa'];
  18. $si_no = $_POST['si_no'];
  19. $estado = $_POST['estado'];
  20. $estimado = $_POST['estimado_obra'];
  21. $requisito = $_POST['requisito'];
  22.  
  23. $fecha = date("Y-m-d");
  24. $fechafin = strtotime('+'.$estimado.' day', strtotime($fecha));
  25. $fechafin = date("Y-m-d", $fechafin);
  26.  
  27. $finpro = strtotime('+'.$prorroga.' day', strtotime($fecha));
  28. $finpro = date("Y-m-d", $finpro);
  29.  
  30. $db = new MySQLi($hostname_seguridad, $username_seguridad, $password_seguridad, $database_seguridad);
  31.  
  32. $query="UPDATE control_contratistas SET rif='$rif',unidad_explot='$unidad',empresa='$empresa',si_no='$si_no',cumple='$cumple',prorroga='$prorroga',estado='$estado',estimado_obra='$estimado',fecha_fin='$fechafin',requisito='$requisito',fin_pro='$finpro' WHERE id='$id'";
  33. $resultado = $db->query($query);
  34.  
  35. if($resultado){
  36.     $msg = "Datos Actualizados";
  37. } else {
  38.     $msg = "No actualizado";
  39. }
[/HIGHLIGHT]