0

the idea is when forzen's time user get limit, change the status congelacion=0, and reset congelacion time

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE cursosxcliente SET idCliente=%s, idCurso=%s, tiempo=%s, valor_curso=%s, congelado=%s, notas_cliente=%s, Fecha_inicio=%s, Fecha_exp=%s,Fecha_inicio_congelacion=%s,Fecha_fin_congelacion=%s WHERE idCursoXCliente=%s",
                       GetSQLValueString($_POST['idCliente'], "int"),
                       GetSQLValueString($_POST['idCurso'], "text"),
                       GetSQLValueString($_POST['tiempo'], "text"),
                       GetSQLValueString($_POST['valor_curso'], "int"),
                       GetSQLValueString($_POST['congelado'], "int"),
                       GetSQLValueString($_POST['notas_cliente'], "text"),
                       GetSQLValueString($_POST['Fecha_inicio'], "text"),
                       GetSQLValueString($_POST['Fecha_exp'], "text"),
                       GetSQLValueString($_POST['Fecha_inicio_congelacion'], "text"),
                       GetSQLValueString($_POST['Fecha_fin_congelacion'], "text"),
                       GetSQLValueString($_POST['idCursoXCliente'], "int"));
$hoy = date("Y-m-d");
$decongelar = explode("-",$row_actualizarCursoCliente['Fecha_fin_congelacion']);
if ($descongelar[0] == $hoy[0] && $descongelar[1] == $hoy[1] && $descongelar[2] == $hoy[2] && $row_actualizarCursoCliente['congelado']=="1") {
    $updateSQLs = sprintf("UPDATE cursosxcliente SET congelado=0,Fecha_inicio_congelacion=default,Fecha_fin_congelacion=default WHERE idCursoXCliente=%s",
    GetSQLValueString($_POST['congelado'], "int"),
    GetSQLValueString($_POST['Fecha_inicio_congelacion'], "text"),
    GetSQLValueString($_POST['Fecha_fin_congelacion'], "text"));
}
  mysql_select_db($database_connectBD_fc, $connectBD_fc);
  $Result1 = mysql_query($updateSQL,$updateSQLs, $connectBD_fc) or die(mysql_error());
  $updateGoTo = "exito-act-curs-cliente.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}

Here is a how it work. but I am not sure why it no update.

  • 2
    You're never actually calling the database query. You're just generating the query string. – aynber Feb 19 '16 at 18:14
  • Learn about prepared statment – Jens Feb 19 '16 at 18:18
  • This is failing you `Fecha_inicio_congelacion=default,Fecha_fin_congelacion=default` and checking for errors would have thrown you something about it. – Funk Forty Niner Feb 19 '16 at 18:20
  • Stop using mysql_ functions. It's deprecated, and removed as of PHP7. Instead, use PDO or mysqli, which will allow you to use prepared statements and parameter binding. – aynber Feb 19 '16 at 18:46

0 Answers0