Foros del Web » Programando para Internet » PHP »

PHP OO enviar valor cuando se termine una fecha

Estas en el tema de enviar valor cuando se termine una fecha en el foro de PHP en Foros del Web. buenas busco enviar un valor (yes) para ser mas especifico por medio de post al terminar una fecha especifica seria una fecha de vencimiento y ...
  #1 (permalink)  
Antiguo 22/01/2017, 13:47
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Busqueda enviar valor cuando se termine una fecha

buenas busco enviar un valor (yes) para ser mas especifico por medio de post al terminar una fecha especifica seria una fecha de vencimiento y darle 2 dias de plazo y enviar ese valor por separado a todas las columna con fecha de vencimiento el motivo de ser por medio de post es que debo enviar datos por medio de una api


GRACIAS de ante manos
  #2 (permalink)  
Antiguo 22/01/2017, 13:53
 
Fecha de Ingreso: noviembre-2003
Ubicación: Zaragoza, España
Mensajes: 1.257
Antigüedad: 20 años, 5 meses
Puntos: 154
Respuesta: enviar valor cuando se termine una fecha

Hola thelighter,

Si nos muestras lo que tienes hecho hasta ahora, será más fácil poder ayudarte. Si quieres que te lo hagan, te recomiendo este foro.
  #3 (permalink)  
Antiguo 22/01/2017, 14:40
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: enviar valor cuando se termine una fecha

Cita:
<link rel="stylesheet" href="../../bootstrap/css/bootstrap.css">
<!-- Bootstrap responsive -->
<link href="../../bootstrap/css/bootstrap-responsive.css" rel="stylesheet" type="text/css">

<?php require ('../../Connections/agregarequipos.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form")) {
$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, tipo=%s WHERE id=%s",
GetSQLValueString($_POST['nombres'], "text"),
GetSQLValueString($_POST['ip'], "text"),
GetSQLValueString($_POST['mac'], "text"),
GetSQLValueString($_POST['cell'], "text"),
GetSQLValueString($_POST['direcion'], "text"),
GetSQLValueString($_POST['comentario'], "text"),
GetSQLValueString($_POST['categoria'], "text"),
GetSQLValueString($_POST['pago_total'], "text"),
GetSQLValueString($_POST['fecha_inicial'], "text"),
GetSQLValueString($_POST['fecha_final'], "text"),
GetSQLValueString($_POST['codigo'], "text"),
GetSQLValueString($_POST['dias_p'], "text"),
GetSQLValueString($_POST['disable'], "text"),
GetSQLValueString($_POST['apellido'], "text"),
GetSQLValueString($_POST['tipo'], "text"),
GetSQLValueString($_POST['id'], "int"));

mysql_select_db($database_agregarequipos, $agregarequipos);
$Result1 = mysql_query($updateSQL, $agregarequipos) or die(mysql_error());
}

$colname_Recordset1 = "-1";
if (isset($_GET['id'])) {
$colname_Recordset1 = $_GET['id'];
}
mysql_select_db($database_agregarequipos, $agregarequipos);
$query_Recordset1 = sprintf("SELECT * FROM clientes WHERE id = %s", GetSQLValueString($colname_Recordset1, "text"));
$Recordset1 = mysql_query($query_Recordset1, $agregarequipos) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_free_result($Recordset1);
?>


<br>
<br>
<hr>


<div class="container-fluid">
<form action="../App/Arp_Dhcp/Editar/editar_arp_dhcp.php" method="post" name="form" id="form">



<div class="row-fluid">
<div class="span2 lightblue">
<label>Nombre.</label>
<input name="nombres" required type="text" class="span12" id="nombres" placeholder="Nombre del Titular" value="<?php echo htmlentities($row_Recordset1['nombres'], ENT_COMPAT, ''); ?>">
</div>


<div class="span5 lightblue">
<label>Apellidos.</label>
<input name="apellido" type="text" class="span12" id="cell" required placeholder="Apellidos del Cliente" value="<?php echo htmlentities($row_Recordset1['apellido'], ENT_COMPAT, ''); ?>">
</div>



<div class="span5 lightblue">
<label>Cell.</label>
<input name="cell" type="text" class="span12" id="cell" required placeholder="# Celular del Cliente" value="<?php echo htmlentities($row_Recordset1['cell'], ENT_COMPAT, ''); ?>">
</div>
<div class="row-fluid">
<div class="span4 lightblue">
<label>IP</label>
<input name="ip" required type="text" class="span12" id="ip" placeholder="Ip del Equipo" value="<?php echo htmlentities($row_Recordset1['ip'], ENT_COMPAT, ''); ?>">
</div>




<div class="span4 lightblue">
<label>mac</label>
<input name="mac" type="text" class="span12" id="mac" required placeholder="Direcion Mac del Cliente" value="<?php echo htmlentities($row_Recordset1['mac'], ENT_COMPAT, ''); ?>">
</div>


<div class="span4 lightblue">
<label>codigo</label>
<input name="codigo" type="text" class="span12" id="codigo" required placeholder="Codigo del Cliente" value="<?php echo htmlentities($row_Recordset1['codigo'], ENT_COMPAT, ''); ?>">
</div>

<div class="row-fluid">


<div class="span4 bgcolor">
<label>Categoria</label>
<select name="categoria" class="span6 input-mini" id="categoria">
<option value="Renta fija" <?php if (!(strcmp("Renta fija", htmlentities($row_Recordset1['categoria'], ENT_COMPAT, '')))) {echo "selected=\"selected\"";} ?>>Renta Fija</option>
<option value="Celulares" <?php if (!(strcmp("Celulares", htmlentities($row_Recordset1['categoria'], ENT_COMPAT, '')))) {echo "selected=\"selected\"";} ?>>Celulares</option>

<option value="Tableta" <?php if (!(strcmp("Tableta", htmlentities($row_Recordset1['categoria'], ENT_COMPAT, '')))) {echo "selected=\"selected\"";} ?>>Tableta</option>

<option value="PC" <?php if (!(strcmp("PC", htmlentities($row_Recordset1['categoria'], ENT_COMPAT, '')))) {echo "selected=\"selected\"";} ?>>PC</option>

<option value="Celulares" <?php if (!(strcmp("Celulares", htmlentities($row_Recordset1['categoria'], ENT_COMPAT, '')))) {echo "selected=\"selected\"";} ?>>Celulares</option>

<option value="Rauter" <?php if (!(strcmp("Rauter", htmlentities($row_Recordset1['categoria'], ENT_COMPAT, '')))) {echo "selected=\"selected\"";} ?>>Rauter</option>

<option value="Varios Equipos" <?php if (!(strcmp("Varios Equipos", htmlentities($row_Recordset1['categoria'], ENT_COMPAT, '')))) {echo "selected=\"selected\"";} ?>>Varios Equipos</option>
</select>
</div>



<div class="span2 bgcolor">
<label>Fecha Inicial</label>
<input name="fecha_inicial" required type="date" class="span12 input-mini" id="fecha_inicial" value="<?php echo htmlentities($row_Recordset1['fecha_inicial'], ENT_COMPAT, ''); ?>">
</div>


  #4 (permalink)  
Antiguo 22/01/2017, 14:42
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: enviar valor cuando se termine una fecha

Cita:

<div class="span2 bgcolor">
<label>Fecha Final</label>
<input name="fecha_final" required type="date" class="span12 input-mini" id="fecha_final" value="<?php echo htmlentities($row_Recordset1['fecha_final'], ENT_COMPAT, ''); ?>">
</div>





<div class="row-fluid">
<div class="span6 bgcolor">
<label>Dias de Pagos</label>
<input name="dias_p" type="number" class="span12 input-mini" id="dias_p" required placeholder="Dias de Pagos del Cliente" value="<?php echo htmlentities($row_Recordset1['dias_p'], ENT_COMPAT, ''); ?>">
</div>


<!--/span-->
<div class="span6 bgcolor">
<label>Total</label>
<input name="pago_total" required type="number" class="span12 input-mini" id="pago_total" placeholder="Total a Pagar" value="<?php echo htmlentities($row_Recordset1['pago_total'], ENT_COMPAT, ''); ?>">
</div>


<div class="row-fluid">
<div class="span12 bgcolor">
<label>Direccion</label>
<input name="direcion" required type="text" class="span12 input-mini" id="direcion" placeholder="Direccion" value="<?php echo htmlentities($row_Recordset1['direcion'], ENT_COMPAT, ''); ?>">
</div>


<div class="row-fluid">
<div class="span12 bgcolor">
<label>Comentarios</label>
<input name="comentario" type="text" class="span12 input-mini" id="comentario" placeholder="Observación" value="<?php echo htmlentities($row_Recordset1['comentario'], ENT_COMPAT, ''); ?>">
</div>



<input type="hidden" name="MM_insert" value="form">
</div>


<div class="checkbox">
<b>
<input type="hidden" name="disable" value="yes" />
<input name="disable" type="checkbox" value="no" /> <b>
<input name="tipo" type="hidden" value="ARP" /> <b>
Activar / Desactivar
</div>


<input name="guardar" type="submit" class="btn-success" id="guardar" value="Guardar" />

<input type="hidden" name="MM_update" value="form" />
<input type="hidden" name="id" value="<?php echo $row_Recordset1['id']; ?>" />
</form>
<p>&nbsp;</p>

<form action="<?php echo $editFormAction; ?>" method="post" name="form" id="form">
<hr>
En el check box lo ago manual necesito pasar datos atabes post.
no se como explicarme necesito consultar la DB y extraer los datos de las filas que contengan las columnas

fecha_final y actualizar el registro con un yes pero que todo pase atabes de un post para poder llegar a la api de mi equipo las lineas de código están un poco osolecta o mal formuladas es de un viejo programa que tengo lo estoy tratando de emigrar a codeigniter pero mi api no funciona en codeigniter
  #5 (permalink)  
Antiguo 22/01/2017, 14:45
 
Fecha de Ingreso: agosto-2011
Mensajes: 36
Antigüedad: 12 años, 8 meses
Puntos: 0
Respuesta: enviar valor cuando se termine una fecha

Cita:
<?php require ('../../Connections/agregarequipos.php'); ?>

<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

$maxRows_Recordset1 = 1000;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_agregarequipos, $agregarequipos);
$query_Recordset1 = "SELECT * FROM clientes WHERE TIMESTAMPDIFF(DAY, fecha_final , CURDATE()) > 1";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $agregarequipos) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>






<div class="box-body">
<table id="example1" class="table table-bordered table-striped">
<thead>
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Cell</th>
<th>Ip</th>

<th>Codigo</th>
<th>Fecha de Corte</th>
<th>Estado</th>
</tr>
</thead>
<tbody>


</tr>
<?php do { ?>
<tr>
<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>
<td><?php echo $row_Recordset1['nombres']; ?>
<?php echo $row_Recordset1['apellido']; ?>&nbsp; </td>
<td><?php echo $row_Recordset1['cell']; ?>&nbsp; </td>
<td><?php echo $row_Recordset1['ip']; ?>&nbsp; </td>
<td><?php echo $row_Recordset1['codigo']; ?>&nbsp;</td>

<td><?php echo $row_Recordset1['fecha_final']; ?>&nbsp; </td>
<td><?php echo $row_Recordset1['disable']; ?>&nbsp; </td>



</tr>
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>


</tbody>
<tfoot>
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Cell</th>
<th>Ip</th>

<th>Codigo</th>
<th>Fecha de Corte</th>
<th>Estado</th>
</tr>
</tfoot>
</table>
en estas lineas creo que estan mas clara mis ideas ya solo mustro los registro que solo tienen fechas vencidas podria enviar un multiple edit la verdad es que no se como hacerlo

Etiquetas: fecha, valor
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 10:44.