Foros del Web » Programando para Internet » PHP »

script automatico editar

Estas en el tema de script automatico editar en el foro de PHP en Foros del Web. buenas mi pregunta es la siguiente tengo un pequeño sistema la cual me funciona de la siguiente manera me agrega a la DB mediante post ...
  #1 (permalink)  
Antiguo 23/05/2016, 19:09
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Busqueda script automatico editar

buenas mi pregunta es la siguiente tengo un pequeño sistema la cual me funciona de la siguiente manera me agrega a la DB mediante post y al mismo tiempo a un equipo el problema es el siguiente cuando llega la fecha de vencimiento me salen todo en una tabla lo que deseo es hacer un script que desde que llegue el día de supencion haga un edit al formulario en base a lo que se encuentra en la tabla dinámica que me aparecen los datos vencidos o enviarle un escript atreve de la variable nombre.

si solo lo edito me hase mas facil por que uso un check box el cual sale debilitado por defecto y si guardo el formulario haci ya estaría listo.

gracias por su colaboración de ante manos
  #2 (permalink)  
Antiguo 24/05/2016, 08:15
 
Fecha de Ingreso: diciembre-2015
Ubicación: México
Mensajes: 280
Antigüedad: 8 años, 5 meses
Puntos: 20
Respuesta: script automatico editar

Hola amigo,
por más que trate de comprender lo que necesitas... no lo logré
Creo q debes redactar mejor tu problemática..
Saludos
  #3 (permalink)  
Antiguo 24/05/2016, 09:28
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: script automatico editar

buenas lo que deseo es cuando llegue la fecha de caducidad hacer un script el cual me mande una variable diciendo YES para que pueda escribir en una api de un equipo le adjunto dos imágenes



en donde dice cliente vencido esta dando un brebe resumen de la cantidad que hay cuando le doy a destalle me muestra todo lo que están vencido, luego que llega el dia el script que uso para que me muestre los clientes vencidos me da dos dias para mostrarme los datos



ya en esta imagen salen todos los clientes vencidos si selecciono uno me manda a la pagina editar



si le doy a guardar sin seleccionar el chekbox me guarda en la api con la opción disabled => "yes"; eso es lo que deseo hacer cuando llegue la fecha final me mande por la variable $disable la opción yes.

gracias de ante amos
  #4 (permalink)  
Antiguo 24/05/2016, 11:33
Avatar de xfxstudios  
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: script automatico editar

a parte de la capturas, debes mostrar los codigos involucrados en el proceso, no sabemos el codigo de tu api o que haces con ella al recibir los datos, por ende debe mostrar codigo para asi leerlo, analizarlo y darte la mejor opcion a tu solicitud. Saludos
__________________
[email protected]
HITCEL
  #5 (permalink)  
Antiguo 24/05/2016, 11:47
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: script automatico editar

buenas este es el codigo que muestra todo los cliente con fecha de caducidad

Código PHP:
Ver original
  1. <?php require_once('../../Connections/agregarequipos.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. $maxRows_Recordset1 = 1000;
  35. $pageNum_Recordset1 = 0;
  36. if (isset($_GET['pageNum_Recordset1'])) {
  37.   $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
  38. }
  39. $startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
  40.  
  41. mysql_select_db($database_agregarequipos, $agregarequipos);
  42. $query_Recordset1 = "SELECT * FROM clientes WHERE TIMESTAMPDIFF(DAY, fecha_final , CURDATE()) > 1";
  43. $query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
  44. $Recordset1 = mysql_query($query_limit_Recordset1, $agregarequipos) or die(mysql_error());
  45. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  46.  
  47. if (isset($_GET['totalRows_Recordset1'])) {
  48.   $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
  49. } else {
  50.   $all_Recordset1 = mysql_query($query_Recordset1);
  51.   $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
  52. }
  53. $totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
  54. ?>
  55.  
  56. <table class="table table-striped table-bordered table-hover" >
  57.         <thead>
  58.   <tr bgcolor="#999999">
  59.     <td>Id</td>
  60.     <td>NOMBRE</td>
  61.     <td>CELL</td>
  62.     <td>IP</td>
  63.     <td>CODIGO</td>
  64.     <td>FECHA FINAL</td>
  65.    
  66.   </tr>
  67.   <?php do { ?>
  68.     <tr>
  69.       <td><a href="http://www.forosdelweb.com/f18/contenido/buscar_cl.php?id=<?php echo $row_Recordset1['id']; ?>"> <?php echo $row_Recordset1['id']; ?>&nbsp; </a></td>
  70.      
  71.       <td><?php echo $row_Recordset1['nombres']; ?>
  72.       <?php echo $row_Recordset1['apellido']; ?>&nbsp; </td>
  73.      
  74.      
  75.       <td><?php echo $row_Recordset1['cell']; ?>&nbsp; </td>
  76.      
  77.       <td><?php echo $row_Recordset1['ip']; ?>&nbsp; </td>
  78.      
  79.       <td><?php echo $row_Recordset1['codigo']; ?>&nbsp; </td>
  80.       <td><?php echo $row_Recordset1['fecha_final']; ?>&nbsp; </td>
  81.      
  82.     </tr>
  83.     <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
  84.  </tbody>
  85. </table> <br />
  86. <table width="150" border="0">
  87.   <tr>
  88.  
  89.  
  90.  
  91. </table>
  92.  
  93. </body>
  94. </html>
  95. <?php
  96. mysql_free_result($Recordset1);
  97. ?>             </div>
  #6 (permalink)  
Antiguo 24/05/2016, 11:55
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: script automatico editar

este es el formulario de edicion

Código PHP:
Ver original
  1. <?php require_once('../../Connections/agregarequipos.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. $editFormAction = $_SERVER['PHP_SELF'];
  35. if (isset($_SERVER['QUERY_STRING'])) {
  36.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  37. }
  38.  
  39. if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form")) {
  40.   $updateSQL = sprintf("UPDATE clientes SET nombres=%s, ip=%s, mac=%s, cell=%s, direcion=%s, comentario=%s, categoria=%s, pago_total=%s, fecha_inicial=%s, fecha_final=%s, codigo=%s, dias_p=%s,disable=%s, apellido=%s WHERE id=%s",
  41.                        GetSQLValueString($_POST['nombres'], "text"),
  42.                        GetSQLValueString($_POST['ip'], "text"),
  43.                        GetSQLValueString($_POST['mac'], "text"),
  44.                        GetSQLValueString($_POST['cell'], "text"),
  45.                        GetSQLValueString($_POST['direcion'], "text"),
  46.                        GetSQLValueString($_POST['comentario'], "text"),
  47.                        GetSQLValueString($_POST['categoria'], "text"),
  48.                        GetSQLValueString($_POST['pago_total'], "text"),
  49.                        GetSQLValueString($_POST['fecha_inicial'], "text"),
  50.                        GetSQLValueString($_POST['fecha_final'], "text"),
  51.                        GetSQLValueString($_POST['codigo'], "text"),
  52.                        GetSQLValueString($_POST['dias_p'], "text"),
  53.                        GetSQLValueString($_POST['disable'], "text"),
  54.                        GetSQLValueString($_POST['apellido'], "text"),
  55.                        GetSQLValueString($_POST['id'], "int"));
  56.  
  57.   mysql_select_db($database_agregarequipos, $agregarequipos);
  58.   $Result1 = mysql_query($updateSQL, $agregarequipos) or die(mysql_error());
  59. }
  60.  
  61. $colname_Recordset1 = "-1";
  62. if (isset($_GET['id'])) {
  63.   $colname_Recordset1 = $_GET['id'];
  64. }
  65. mysql_select_db($database_agregarequipos, $agregarequipos);
  66. $query_Recordset1 = sprintf("SELECT * FROM clientes WHERE id = %s", GetSQLValueString($colname_Recordset1, "text"));
  67. $Recordset1 = mysql_query($query_Recordset1, $agregarequipos) or die(mysql_error());
  68. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  69. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  70.  
  71. mysql_free_result($Recordset1);
  72. ?>
  73.  
  74.  
  75. <form  action="../app/Arp_Dhcp/Editar/editar_arp_dhcp.php" method="post" name="form" id="form">
  76.  
  77.  
  78.    
  79.      <div class="row-fluid">
  80.     <div class="span2 lightblue">
  81.               <label>Nombre.</label>
  82.               <input name="nombres" required type="text" class="span12" id="nombres" placeholder="Nombre del Titular" value="<?php echo htmlentities($row_Recordset1['nombres'], ENT_COMPAT, ''); ?>">          
  83.             </div>
  84.            
  85.            
  86.             <div class="span5 lightblue">
  87.               <label>Apellidos.</label>
  88.               <input name="apellido" type="text" class="span12" id="cell" required placeholder="Apellidos del Cliente" value="<?php echo htmlentities($row_Recordset1['apellido'], ENT_COMPAT, ''); ?>">    
  89.             </div>
  90.            
  91.            
  92.            
  93.             <div class="span5 lightblue">
  94.               <label>Cell.</label>
  95.               <input name="cell" type="text" class="span12" id="cell" required placeholder="# Celular del Cliente" value="<?php echo htmlentities($row_Recordset1['cell'], ENT_COMPAT, ''); ?>">    
  96.             </div>
  97.             <div class="row-fluid">
  98.     <div class="span4 lightblue">
  99.               <label>IP</label>
  100.               <input name="ip" required type="text" class="span12" id="ip" placeholder="Ip del Equipo" value="<?php echo htmlentities($row_Recordset1['ip'], ENT_COMPAT, ''); ?>">    
  101.             </div>
  #7 (permalink)  
Antiguo 24/05/2016, 12:00
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: script automatico editar

este es el codigo que el cual procesa el formulario editar el cual tiene la api del equipo incluida

Código PHP:
Ver original
  1. <?php require_once('../../../../Connections/agregarequipos.php'); ?>
  2. <?php
  3. if (!function_exists("GetSQLValueString")) {
  4. function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
  5. {
  6.   if (PHP_VERSION < 6) {
  7.     $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  8.   }
  9.  
  10.   $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  11.  
  12.   switch ($theType) {
  13.     case "text":
  14.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  15.       break;    
  16.     case "long":
  17.     case "int":
  18.       $theValue = ($theValue != "") ? intval($theValue) : "NULL";
  19.       break;
  20.     case "double":
  21.       $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
  22.       break;
  23.     case "date":
  24.       $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
  25.       break;
  26.     case "defined":
  27.       $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
  28.       break;
  29.   }
  30.   return $theValue;
  31. }
  32. }
  33.  
  34. $editFormAction = $_SERVER['PHP_SELF'];
  35. if (isset($_SERVER['QUERY_STRING'])) {
  36.   $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
  37. }
  38.  
  39. if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form")) {
  40.   $updateSQL = sprintf("UPDATE clientes SET nombres=%s, ip=%s, mac=%s, cell=%s, direcion=%s, comentario=%s, categoria=%s, pago_total=%s, fecha_inicial=%s, fecha_final=%s, codigo=%s, dias_p=%s, disable=%s, apellido=%s WHERE id=%s",
  41.                        GetSQLValueString($_POST['nombres'], "text"),
  42.                        GetSQLValueString($ip = $_POST['ip'], "text"),
  43.                        GetSQLValueString($mac = $_POST['mac'], "text"),
  44.                        GetSQLValueString($_POST['cell'], "text"),
  45.                        GetSQLValueString($_POST['direcion'], "text"),
  46.                        GetSQLValueString($_POST['comentario'], "text"),
  47.                        GetSQLValueString($_POST['categoria'], "text"),
  48.                        GetSQLValueString($_POST['pago_total'], "text"),
  49.                        GetSQLValueString($_POST['fecha_inicial'], "text"),
  50.                        GetSQLValueString($fecha_final = $_POST['fecha_final'], "text"),
  51.                        GetSQLValueString($_POST['codigo'], "text"),
  52.                        GetSQLValueString($_POST['dias_p'], "text"),
  53.                        GetSQLValueString($_POST['disable'], "text"),
  54.                        GetSQLValueString($_POST['apellido'], "text"),
  55.                        GetSQLValueString($_POST['id'], "int"));
  56.  
  57.   mysql_select_db($database_agregarequipos, $agregarequipos);
  58.   $Result1 = mysql_query($updateSQL, $agregarequipos) or die(mysql_error());
  59. }
  60.  
  61. $colname_Recordset1 = "-1";
  62. if (isset($_GET['nombres'])) {
  63.   $colname_Recordset1 = $_GET['nombres'];
  64. }
  65. mysql_select_db($database_agregarequipos, $agregarequipos);
  66. $query_Recordset1 = sprintf("SELECT * FROM clientes WHERE nombres = %s", GetSQLValueString($colname_Recordset1, "text"));
  67. $Recordset1 = mysql_query($query_Recordset1, $agregarequipos) or die(mysql_error());
  68. $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  69. $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  70.  
  71. mysql_free_result($Recordset1);
  72.  
  73.  
  74.  
  75. require('../../api/routeros_api.class.php');
  76. require('../../../../Connections/miktik.php');
  77. $API = new RouterosAPI();
  78.  
  79. $API->debug = true;
  80.  
  81. $API->connect($ipRB , $Username , $clave, $api_puerto);
  82.  
  83. $BRIDGEINFO2 = $API->comm('/ip/arp/print', array(
  84.             ".proplist" => ".id",
  85.             "?address"  => "$ip",
  86.            
  87. ));
  88. $API->comm("/ip/arp/set", array(
  89.           ".id"=>$BRIDGEINFO2[0]['.id'],
  90.           "address"  => "$ip",
  91.             "mac-address"  => "$mac",
  92.             "comment"  => "$fecha_final",
  93.  
  94. ));
  95.  
  96.  
  97.  
  98.  {
  99.  
  100.  
  101. $BRIDGEINFO2 = $API->comm('/ip/dhcp-server/lease/print', array(
  102.             ".proplist" => ".id",
  103.             "?address"  => "$ip"
  104. ));
  105. $API->comm("/ip/dhcp-server/lease/set", array(
  106.           ".id"=>$BRIDGEINFO2[0]['.id'],
  107.           "address" => $ip,
  108.       "always-broadcast" => "yes",
  109.       "use-src-mac" => "yes",
  110.      "mac-address" => $mac,
  111.      "comment" => $fecha_final,
  112.          
  113.  
  114. ));
  115.  
  116. $disable =  $_POST['disable'];
  117. $BRIDGEINFO2 = $API->comm('/ip/arp/print', array(
  118.             ".proplist" => ".id",
  119.             "?address"  => "$ip"
  120. ));
  121. $API->comm("/ip/arp/set", array(
  122.           ".id"=>$BRIDGEINFO2[0]['.id'],
  123.           "disabled"    => "$disable"
  124.  
  125. ));
  126.  
  127.  
  128.    $API->disconnect();
  129.  
  130. }
  131.  
  132.  
  133. ?>
  134. <!DOCTYPE html>
  135. <html>
  136. <head>
  137. <meta http-equiv="refresh" content="0;url=../../../../index.php">
  138. <title>PlayCenter Universal</title>
  139. <script language="javascript">
  140.     window.location.href = "../../../../index.php"
  141. </script>
  142. </head>
  143. <body>
  144. Go to <a href="../../../../index.php">index.php</a>
  145. </body>
  146. </html>

le tengo un redirecionamiento para no dejar en la pantalla todo los codigos de la api del equipo
  #8 (permalink)  
Antiguo 24/05/2016, 12:03
 
Fecha de Ingreso: diciembre-2015
Ubicación: México
Mensajes: 280
Antigüedad: 8 años, 5 meses
Puntos: 20
Respuesta: script automatico editar

Hola amigo, sigo sin entender muy bien tu problemática..
Lo que he llegado a comprender ( a grandes rasgos, porque la verdad te hace falta redactar mejor) es:
Una vez que estás dentro de la tabla de clientes vencidos, si la fecha de caducidad del cliente se cumple, debes de agregar un checkbox para que se pueda editar?
  #9 (permalink)  
Antiguo 24/05/2016, 16:08
Avatar de xfxstudios  
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: script automatico editar

otra cosa, veo que estas trabajando con las querys por defecto de dreamweaver, cosa que no te recomiendo, pues cuando vallas a queres hacer una edicion o personalizar tu codigo, te va a dar problemas sin contar el hecho de que estan un poco obsoletas ya que trabajan con mysql y no con mysqli
__________________
[email protected]
HITCEL
  #10 (permalink)  
Antiguo 25/05/2016, 12:51
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: script automatico editar

Cita:
Iniciado por german_1441 Ver Mensaje
Hola amigo, sigo sin entender muy bien tu problemática..
Lo que he llegado a comprender ( a grandes rasgos, porque la verdad te hace falta redactar mejor) es:
Una vez que estás dentro de la tabla de clientes vencidos, si la fecha de caducidad del cliente se cumple, debes de agregar un checkbox para que se pueda editar?

lo que necesito hacer es que cuando llegue la fecha de corte me cambie el estado de havilitado a desavilitado
  #11 (permalink)  
Antiguo 25/05/2016, 12:53
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: script automatico editar

Cita:
Iniciado por xfxstudios Ver Mensaje
otra cosa, veo que estas trabajando con las querys por defecto de dreamweaver, cosa que no te recomiendo, pues cuando vallas a queres hacer una edicion o personalizar tu codigo, te va a dar problemas sin contar el hecho de que estan un poco obsoletas ya que trabajan con mysql y no con mysqli
realmente se que trabaje mal al usar dream toda mi vida me base en dream y hoy no se nada por eso estoy cambiando el sistema poco a poco ese scritp le hise ya hace unos años
  #12 (permalink)  
Antiguo 25/05/2016, 17:19
Avatar de xfxstudios  
Fecha de Ingreso: junio-2015
Ubicación: Valencia - Venezuela
Mensajes: 2.448
Antigüedad: 8 años, 10 meses
Puntos: 263
Respuesta: script automatico editar

en todo caso debes crearte un codigo que verifique cada dia la base de datos y si encuentra contactos que coincidan pues los actualice:

Ejemplo:

Código PHP:
Ver original
  1. $fecha  = date("Y-m-d");
  2.  
  3. $busca = $db->query("SELECT id,fecha,estado FROM contactos WHERE fecha = '$fecha'");
  4. $t = mysqli_num_rows($busca);
  5.  
  6. if($t >=1){
  7. while($row = $busca->fetch_array()){
  8.  
  9. $actualiza = $db->query("UPDATE contactos SET estado = 'inactivo' WHERE id = '$row[id]' ");
  10.  
  11. }
  12.  
  13. }else{
  14. //codigo si no hay contactos a inhabilitar ese día
  15. }

Como dije es un ejemplo y deberas adaptarlo a tu tabla y datos asi como configurarlo en algún cronjob para su ejecución automatica.

Saludos

NOTA: ese codigo esta en mysqli.
__________________
[email protected]
HITCEL
  #13 (permalink)  
Antiguo 26/05/2016, 13:12
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: script automatico editar

Cita:
Iniciado por xfxstudios Ver Mensaje
en todo caso debes crearte un codigo que verifique cada dia la base de datos y si encuentra contactos que coincidan pues los actualice:

Ejemplo:

Código PHP:
Ver original
  1. $fecha  = date("Y-m-d");
  2.  
  3. $busca = $db->query("SELECT id,fecha,estado FROM contactos WHERE fecha = '$fecha'");
  4. $t = mysqli_num_rows($busca);
  5.  
  6. if($t >=1){
  7. while($row = $busca->fetch_array()){
  8.  
  9. $actualiza = $db->query("UPDATE contactos SET estado = 'inactivo' WHERE id = '$row[id]' ");
  10.  
  11. }
  12.  
  13. }else{
  14. //codigo si no hay contactos a inhabilitar ese día
  15. }

Como dije es un ejemplo y deberas adaptarlo a tu tabla y datos asi como configurarlo en algún cronjob para su ejecución automatica.

Saludos

NOTA: ese codigo esta en mysqli.

exactamente eso es lo que necesito tengo varias horas intentando ponerlo a funcionar

Etiquetas: automatico, fecha, formulario, tabla, variable
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:06.