Bonjour,
je fais un update sur une table et tous les champs se mettent a jour sauf les dates qui se reinitialisent à 0000-00-00.
Savez vous d'ou peut venir le probleme??

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php require_once('Connections/bibliodec.php'); ?>
<?php
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_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE adherent SET nom_adherent=%s, prenom_adherent=%s, date_naissance=%s, adresse=%s, code_postal=%s, localite=%s, date_renouvellement=%s WHERE num_adherent=%s",
                       GetSQLValueString($_POST['Nom'], "text"),
                       GetSQLValueString($_POST['Prenom'], "text"),
                       GetSQLValueString($_POST['Date de naissance'], "date"),
                       GetSQLValueString($_POST['Adresse'], "text"),
                       GetSQLValueString($_POST['CP'], "int"),
                       GetSQLValueString($_POST['Localite'], "text"),
                       GetSQLValueString($_POST['Date de renouvellement'], "date"),
                       GetSQLValueString($_POST['Num_adherent'], "text"));
 
  mysql_select_db($database_bibliodec, $bibliodec);
  $Result1 = mysql_query($updateSQL, $bibliodec) or die(mysql_error());
 
  $updateGoTo = "connection.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}
Merci par avance
Aquafafa