Ver Mensaje Individual
  #1 (permalink)  
Antiguo 12/06/2013, 16:35
hfer64
 
Fecha de Ingreso: junio-2013
Mensajes: 9
Antigüedad: 10 años, 10 meses
Puntos: 0
insertar fechas con php en mysql

Buenas tardes...
Estoy realizando una pagina con conexión a mysql donde se lleva el control de unos clientes para ser mas especifico son clientes de bodas, el problema es que debo de guardarlos yyyy-mm-aa pero yo quiero guardarlos con formato aa-mm-yyyy y no se como, ya estuve leyendo varios temas pero no he entendido muy bien les dejo un ejemplo para ver si pueden ayudarme gracias
Esto es lo que tengo al principio del codigo:
Código PHP:
<?php require_once('../Connections/bodas.php'); ?>
<?php
if (!isset($_SESSION)) {
  
session_start();
}
$MM_authorizedUsers "1";
$MM_donotCheckaccess "false";
function 
isAuthorized($strUsers$strGroups$UserName$UserGroup) { 
    
$isValid False
  if (!empty(
$UserName)) { 
    
$arrUsers Explode(","$strUsers); 
    
$arrGroups Explode(","$strGroups); 
    if (
in_array($UserName$arrUsers)) { 
      
$isValid true
    } 
    if (
in_array($UserGroup$arrGroups)) { 
      
$isValid true
    } 
    if ((
$strUsers == "") && false) { 
      
$isValid true
    } 
  } 
  return 
$isValid
}

$MM_restrictGoTo "../Inicio/error.php";
if (!((isset(
$_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers$_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {   
  
$MM_qsChar "?";
  
$MM_referrer $_SERVER['PHP_SELF'];
  if (
strpos($MM_restrictGoTo"?")) $MM_qsChar "&";
  if (isset(
$_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0
  
$MM_referrer .= "?" $_SERVER['QUERY_STRING'];
  
$MM_restrictGoTo $MM_restrictGoTo$MM_qsChar "accesscheck=" urlencode($MM_referrer);
  
header("Location: "$MM_restrictGoTo); 
  exit;
}
?>
<?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"] == "form2")) {
  
$updateSQL sprintf("UPDATE datos_clientes SET datos_del_que_contrata=%s, fecha_boda=%s, lugar=%s, trash_servicio=%s, casual_servicio=%s, boudoir=%s, welcome_stage=%s, fotografo_welcome=%s, otros_servicios=%s, nombre_novia=%s, movil_novia=%s, e_mail_novia=%s, nombre_novio=%s, movil_novio=%s, e_mail_novio=%s, fotografo_asignado=%s, cliente_de_portal=%s, paquete=%s WHERE couture_id=%s",
                       
GetSQLValueString($_POST['datos_del_que_contrata'], "text"),
                       
GetSQLValueString($_POST['fecha_boda'], "date"),
                       
GetSQLValueString($_POST['lugar'], "text"),
                       
GetSQLValueString($_POST['trash_servicio'], "text"),
                       
GetSQLValueString($_POST['casual_servicio'], "text"),
                       
GetSQLValueString($_POST['boudoir'], "text"),
                       
GetSQLValueString($_POST['welcome_stage'], "text"),
                       
GetSQLValueString($_POST['fotografo_welcome'], "text"),
                       
GetSQLValueString($_POST['otros_servicios'], "text"),
                       
GetSQLValueString($_POST['nombre_novia'], "text"),
                       
GetSQLValueString($_POST['movil_novia'], "text"),
                       
GetSQLValueString($_POST['e_mail_novia'], "text"),
                       
GetSQLValueString($_POST['nombre_novio'], "text"),
                       
GetSQLValueString($_POST['movil_novio'], "text"),
                       
GetSQLValueString($_POST['e_mail_novio'], "text"),
                       
GetSQLValueString($_POST['fotografo_asignado'], "text"),
                       
GetSQLValueString($_POST['cliente_de_portal'], "text"),
                       
GetSQLValueString($_POST['paquete'], "text"),
                       
GetSQLValueString($_POST['couture_id'], "text"));

  
mysql_select_db($database_bodas$bodas);
  
$Result1 mysql_query($updateSQL$bodas) or die(mysql_error());