Foros del Web » Programando para Internet » PHP »

Crear registro de Fecha

Estas en el tema de Crear registro de Fecha en el foro de PHP en Foros del Web. Hola a todos, Nececito crear en una base de datos un registro para que cada vez que se cree un registro nuevo en la base ...
  #1 (permalink)  
Antiguo 09/06/2007, 18:34
 
Fecha de Ingreso: mayo-2007
Mensajes: 41
Antigüedad: 16 años, 10 meses
Puntos: 0
Crear registro de Fecha

Hola a todos,

Nececito crear en una base de datos un registro para que cada vez que se cree un registro nuevo en la base de datos, quede registrado la fecha que lo hiso.

Estoy trabajando con Dreamweaver y soy muy tonto para estas cosas, agradeceria cualquier info para que me ayude ha hacer lo que quiero.

Gracias
  #2 (permalink)  
Antiguo 09/06/2007, 18:55
Avatar de Gerald  
Fecha de Ingreso: julio-2003
Mensajes: 1.356
Antigüedad: 20 años, 9 meses
Puntos: 2
Re: Crear registro de Fecha

cuando insertes los datos en tu tabla obtienes la fecha haciendo uso de la funcion www.php.net/time
__________________
Solo por Hoy: Trataré de fortalecer mi mente. Estudiaré y aprenderé algo útil
Hoteldipity
Arte Caracol
  #3 (permalink)  
Antiguo 09/06/2007, 19:02
 
Fecha de Ingreso: mayo-2007
Mensajes: 41
Antigüedad: 16 años, 10 meses
Puntos: 0
Re: Crear registro de Fecha

ok,

como dige antes soy un poco lento para esto porque aun estoy aprendiendo.

Supongamos que el codigo es asi (esta generado por Dreamweaver):

Código PHP:
<?php
ob_start
();
function 
GetSQLValueString($theValue$theType$theDefinedValue ""$theNotDefinedValue ""
{
  
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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_insert"])) && ($_POST["MM_insert"] == "form3")) {
  
$insertSQL sprintf("INSERT INTO datos (rut, dverificador, nombre, email, direccion, comuna, ciudad, pais, carea, telefono) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                       
GetSQLValueString($_POST['rut'], "text"),
                       
GetSQLValueString($_POST['dverificador'], "text"),
                       
GetSQLValueString($_POST['nombre'], "text"),
                       
GetSQLValueString($_POST['email'], "text"),
                       
GetSQLValueString($_POST['direccion'], "text"),
                       
GetSQLValueString($_POST['comuna'], "text"),
                       
GetSQLValueString($_POST['ciudad'], "text"),
                       
GetSQLValueString($_POST['pais'], "text"),
                       
GetSQLValueString($_POST['carea'], "text"),
                       
GetSQLValueString($_POST['telefono'], "text"));

  
mysql_select_db($database_datos$datos);
  
$Result1 mysql_query($insertSQL$datos) or die(mysql_error());

  
$insertGoTo "datosok.php";
  if (isset(
$_SERVER['QUERY_STRING'])) {
    
$insertGoTo .= (strpos($insertGoTo'?')) ? "&" "?";
    
$insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  
ob_clean();
  
header(sprintf("Location: %s"$insertGoTo));
  exit();
}

?>
Donde lo deveria incertar????

Debo crear un espacio en la table que almacene los datos de las fechas???


Gracias
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 12:21.