Ver Mensaje Individual
  #1 (permalink)  
Antiguo 31/01/2014, 09:58
clnetcom
 
Fecha de Ingreso: septiembre-2010
Mensajes: 32
Antigüedad: 13 años, 7 meses
Puntos: 0
Donde esta el error????

Estimad@s

Alguien me puede ayudar a descubrir la causa de que no se realicen los registros en la base de datos??


<?php
$NombreBD = "registros";
$Servidor = "localhost";
$Usuario = "root";
$Password ="123123";
$IdConexion = mysql_connect($Servidor, $Usuario, $Password);
mysql_select_db($NombreBD, $IdConexion);

// sample data from user input:
$f_inicio = ('2014-01-31');
$f_termino = ('2014-02-16');

$hora_1 = ('08:00:00');
$hora_2 = ('08:17:00');
$hora_3 = ('08:32:00');
$origen = ('ESTERILIZACION');
$destino = ('UCI');
$funcionario = ('JPEREZ');


$startTime = strtotime($f_inicio);
$endTime = strtotime($f_termino);
$values = array();
for($time = $startTime; $time <= $endTime; $time = strtotime('+1 day', $time))
{
$thisDate = date('Y-m-d', $time);
$values[] = "($destino, $funcionario, $origen, '$thisDate' , $hora_1, $hora_2, $hora_3)";
}

//
$query = sprintf(
"INSERT INTO reg (date, origen, destino, funcionario, hora_1, hora_2, hora_3 ) VALUES\n%s",
implode(",\n", $values)
);

// Imprime
echo "<pre>$query</pre>";

?>

Última edición por clnetcom; 31/01/2014 a las 10:06