Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD > PHP & MySQL
PHP & MySQL Forum d'entraide sur les fonctions MySQL avec PHP. Avant de poster -> FAQ MySQL, Cours MySQL et Sources MySQL. Pour les questions concernant le moteur MySQL plutôt que les fonctions PHP, merci d'utiliser le forum MySQL.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 07/02/2012, 16h00   #1
Candidat au titre de Membre du Club
 
Inscription : mars 2009
Messages : 81
Détails du profil
Informations forums :
Inscription : mars 2009
Messages : 81
Points : 10
Points : 10
Par défaut probleme de modification des enregistrement

salut
voila mon code de modification
et je ne sais pourquoi sa marche pas
j'éspére qu'il ya quelequ'un qui peux m'aidé
merci d'avance
a bientot
voila le code
Code :
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
<?php require_once('Connections/connection.php'); ?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
 
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 ats SET Nom=%s, Prenom=%s, mail=%s, Datenai=%s, Adresse=%s, cvl=%s, Nbrenfant=%s, Ntel=%s, Grade=%s, Situationtravail=%s WHERE id=%s",
                       GetSQLValueString($_POST['Nom'], "text"),
                       GetSQLValueString($_POST['Prenom'], "text"),
                       GetSQLValueString($_POST['mail'], "text"),
                       GetSQLValueString($_POST['Datenai'], "date"),
                       GetSQLValueString($_POST['Adresse'], "text"),
                       GetSQLValueString($_POST['cvl'], "text"),
                       GetSQLValueString($_POST['Nbrenfant'], "int"),
                       GetSQLValueString($_POST['Ntel'], "int"),
                       GetSQLValueString($_POST['Grade'], "text"),
                       GetSQLValueString($_POST['Situationtravail'], "text"),
                       GetSQLValueString($_POST['id'], "text"));
 
  mysql_select_db($database_connection, $connection);
  $Result1 = mysql_query($updateSQL, $connection) or die(mysql_error());
 
  $updateGoTo = "mod3.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
    $updateGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $updateGoTo));
}
 
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
 
mysql_select_db($database_connection, $connection);
$query_Recordset1 = "SELECT * FROM ats";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $connection) 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;
 
$queryString_Recordset1 = "";
if (!empty($_SERVER['QUERY_STRING'])) {
  $params = explode("&", $_SERVER['QUERY_STRING']);
  $newParams = array();
  foreach ($params as $param) {
    if (stristr($param, "pageNum_Recordset1") == false && 
        stristr($param, "totalRows_Recordset1") == false) {
      array_push($newParams, $param);
    }
  }
  if (count($newParams) != 0) {
    $queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));
  }
}
$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1, $queryString_Recordset1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<body>
<table border="1" align="center">
  <tr>
    <td>id</td>
    <td>Nom</td>
    <td>Prenom</td>
    <td>mail</td>
    <td>Datenai</td>
    <td>Adresse</td>
    <td>cvl</td>
    <td>Nbrenfant</td>
    <td>Ntel</td>
    <td>Grade</td>
    <td>Situationtravail</td>
  </tr>
  <?php do { ?>
  <tr>
    <td> <a href="mod2.php?recordID=<?php echo $row_Recordset1['id']; ?>"> <?php echo $row_Recordset1['id']; ?>&nbsp; </a> </td>
    <td> <?php echo $row_Recordset1['Nom']; ?>&nbsp; </td>
    <td> <?php echo $row_Recordset1['Prenom']; ?>&nbsp; </td>
    <td> <?php echo $row_Recordset1['mail']; ?>&nbsp; </td>
    <td> <?php echo $row_Recordset1['Datenai']; ?>&nbsp; </td>
    <td> <?php echo $row_Recordset1['Adresse']; ?>&nbsp; </td>
    <td> <?php echo $row_Recordset1['cvl']; ?>&nbsp; </td>
    <td> <?php echo $row_Recordset1['Nbrenfant']; ?>&nbsp; </td>
    <td> <?php echo $row_Recordset1['Ntel']; ?>&nbsp; </td>
    <td> <?php echo $row_Recordset1['Grade']; ?>&nbsp; </td>
    <td> <?php echo $row_Recordset1['Situationtravail']; ?>&nbsp; </td>
  </tr>
  <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<br>
<table border="0" width="50%" align="center">
  <tr>
    <td width="23%" align="center">
      <?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">First</a>
      <?php } // Show if not first page ?>
    </td>
    <td width="31%" align="center">
      <?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Previous</a>
      <?php } // Show if not first page ?>
    </td>
    <td width="23%" align="center">
      <?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Next</a>
      <?php } // Show if not last page ?>
    </td>
    <td width="23%" align="center">
      <?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>
      <a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Last</a>
      <?php } // Show if not last page ?>
    </td>
  </tr>
</table>
Records <?php echo ($startRow_Recordset1 + 1) ?> to <?php echo min($startRow_Recordset1 + $maxRows_Recordset1, $totalRows_Recordset1) ?> of <?php echo $totalRows_Recordset1 ?>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
le deuxieme
Code :
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<?php require_once('Connections/connection.php'); ?><?php
$maxRows_DetailRS1 = 10;
$pageNum_DetailRS1 = 0;
if (isset($_GET['pageNum_DetailRS1'])) {
  $pageNum_DetailRS1 = $_GET['pageNum_DetailRS1'];
}
$startRow_DetailRS1 = $pageNum_DetailRS1 * $maxRows_DetailRS1;
 
mysql_select_db($database_connection, $connection);
$recordID = $_GET['recordID'];
$query_DetailRS1 = "SELECT * FROM ats WHERE id = '$recordID'";
$query_limit_DetailRS1 = sprintf("%s LIMIT %d, %d", $query_DetailRS1, $startRow_DetailRS1, $maxRows_DetailRS1);
$DetailRS1 = mysql_query($query_limit_DetailRS1, $connection) or die(mysql_error());
$row_DetailRS1 = mysql_fetch_assoc($DetailRS1);
 
if (isset($_GET['totalRows_DetailRS1'])) {
  $totalRows_DetailRS1 = $_GET['totalRows_DetailRS1'];
} else {
  $all_DetailRS1 = mysql_query($query_DetailRS1);
  $totalRows_DetailRS1 = mysql_num_rows($all_DetailRS1);
}
$totalPages_DetailRS1 = ceil($totalRows_DetailRS1/$maxRows_DetailRS1)-1;
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<body>
 
<table border="1" align="center">
 
  <tr>
    <td>id</td>
    <td><?php echo $row_DetailRS1['id']; ?> </td>
  </tr>
  <tr>
    <td>Nom</td>
    <td><?php echo $row_DetailRS1['Nom']; ?> </td>
  </tr>
  <tr>
    <td>Prenom</td>
    <td><?php echo $row_DetailRS1['Prenom']; ?> </td>
  </tr>
  <tr>
    <td>mail</td>
    <td><?php echo $row_DetailRS1['mail']; ?> </td>
  </tr>
  <tr>
    <td>Datenai</td>
    <td><?php echo $row_DetailRS1['Datenai']; ?> </td>
  </tr>
  <tr>
    <td>Adresse</td>
    <td><?php echo $row_DetailRS1['Adresse']; ?> </td>
  </tr>
  <tr>
    <td>cvl</td>
    <td><?php echo $row_DetailRS1['cvl']; ?> </td>
  </tr>
  <tr>
    <td>Nbrenfant</td>
    <td><?php echo $row_DetailRS1['Nbrenfant']; ?> </td>
  </tr>
  <tr>
    <td>Ntel</td>
    <td><?php echo $row_DetailRS1['Ntel']; ?> </td>
  </tr>
  <tr>
    <td>Grade</td>
    <td><?php echo $row_DetailRS1['Grade']; ?> </td>
  </tr>
  <tr>
    <td>Situationtravail</td>
    <td><?php echo $row_DetailRS1['Situationtravail']; ?> </td>
  </tr>
 
 
</table>
 
 
<form method="post" name="form1" action="<?php echo $editFormAction; ?>">
  <table align="center">
    <tr valign="baseline">
      <td nowrap align="right">Id:</td>
      <td><?php echo $row_Recordset1['id']; ?></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Nom:</td>
      <td><input type="text" name="Nom" value="<?php echo $row_Recordset1['Nom']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Prenom:</td>
      <td><input type="text" name="Prenom" value="<?php echo $row_Recordset1['Prenom']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Mail:</td>
      <td><input type="text" name="mail" value="<?php echo $row_Recordset1['mail']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Datenai:</td>
      <td><input type="text" name="Datenai" value="<?php echo $row_Recordset1['Datenai']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Adresse:</td>
      <td><input type="text" name="Adresse" value="<?php echo $row_Recordset1['Adresse']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Cvl:</td>
      <td><input type="text" name="cvl" value="<?php echo $row_Recordset1['cvl']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Nbrenfant:</td>
      <td><input type="text" name="Nbrenfant" value="<?php echo $row_Recordset1['Nbrenfant']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Ntel:</td>
      <td><input type="text" name="Ntel" value="<?php echo $row_Recordset1['Ntel']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Grade:</td>
      <td><input type="text" name="Grade" value="<?php echo $row_Recordset1['Grade']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">Situationtravail:</td>
      <td><input type="text" name="Situationtravail" value="<?php echo $row_Recordset1['Situationtravail']; ?>" size="32"></td>
    </tr>
    <tr valign="baseline">
      <td nowrap align="right">&nbsp;</td>
      <td><input name="submit" type="submit" value="Update record"></td>
    </tr>
  </table>
  <input type="hidden" name="MM_update" value="form1">
  <input type="hidden" name="id" value="<?php echo $row_Recordset1['id']; ?>">
</form>
<p>&nbsp;</p>
</body>
</html><?php
mysql_free_result($DetailRS1);
?>
et le 3 eme
Code :
1
2
3
4
5
6
7
8
9
10
11
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
 
<body>
votre modification est bien fait 
</body>
</html>
merci
fleurrouge est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 08/02/2012, 16h30   #2
Modératrice
 
Avatar de Celira
 
Femme
Développeuse PHP/Java
Inscription : avril 2007
Messages : 3 678
Détails du profil
Informations personnelles :
Sexe : Femme
Âge : 27
Localisation : France

Informations professionnelles :
Activité : Développeuse PHP/Java

Informations forums :
Inscription : avril 2007
Messages : 3 678
Points : 5 425
Points : 5 425
"ça ne marche pas" c'est un peu vague...
A quel moment ça plante ? que se passe-t-il ? Tu obtiens un message d'erreur, une page blanche, ton ordinateur explose ?
__________________
Modératrice PHP
Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)

Pour afficher votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur)
Celira est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 11h46   #3
Candidat au titre de Membre du Club
 
Inscription : mars 2009
Messages : 81
Détails du profil
Informations forums :
Inscription : mars 2009
Messages : 81
Points : 10
Points : 10
salut
bon je l'ai corriger par un autre code de modification
voila 3 code
le premier

Code :
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
<html>
  <head>
    <title>modification de données en PHP :: partie 1</title>
  </head>
<body>
  <?php
    //connection au serveur:
    $cnx = mysql_connect( "localhost", "root", "" ) ;
 
    //sélection de la base de données:
    $db = mysql_select_db( "epst" ) ;
 
    //requête SQL:
    $sql = "SELECT *
	       FROM ats
	      ORDER BY Nom" ;
 
    //exécution de la requête:
    $requete = mysql_query( $sql, $cnx ) ;
 
    //affichage des données:
    while( $result = mysql_fetch_object( $requete ) )
    {
       echo(
           "<div align=\"center\">"
            .$result->id." "    .$result->Nom." "     .$result->Prenom
 
           ." <a href=\"wafaamodification2.php?idats=" .$result->id."\">  modifier </a> </div>\n"
       ) ;
    }
  ?>
</body>
</html>

le deuxieme
Code :
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
<html>
  <head>
    <title>modification de données en PHP :: partie2</title>
  </head>
<body>
 <?php
  //connection au serveur:
  $cnx = mysql_connect( "localhost", "root", "" ) ;
 
  //sélection de la base de données:
  $db = mysql_select_db( "epst" ) ;
 
  //récupération de la variable d'URL,
  //qui va nous permettre de savoir quel enregistrement modifier
  $id  = $_GET["idats"] ;
 
  //requête SQL:
  $sql = "SELECT *
          FROM ats
	    WHERE id =  " .$id ;
 
  //exécution de la requête:
  $requete = mysql_query( $sql, $cnx ) ;
 
  //affichage des données:
  if( $result = mysql_fetch_object( $requete ) )
  {
  ?>
  <form name="insertion" action="wafaamodification3.php" method="POST">
  <input type="hidden" name="id" value="<?php echo($id) ;?>">
  <table border="0" align="center" cellspacing="2" cellpadding="2">
    <tr align="center">
      <td>nom</td>
      <td><input type="text" name="nom" value="<?php echo($result->Nom) ;?>"></td>
    </tr>
    <tr align="center">
      <td>prenom</td>
      <td><input type="text" name="prenom" value="<?php echo($result->Prenom) ;?>"></td>
    </tr>
    <tr align="center">
      <td>adresse</td>
      <td><input type="text" name="adresse" value="<?php echo($result->Adresse) ;?>"></td>
    </tr>
    <tr align="center">
      <td colspan="2"><input type="submit" value="modifier"></td>
    </tr>
  </table>
</form>
 <?php
  }//fin if 
  ?>
 </body>
</html>
le troisieme

Code :
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
<?php
  //connection au serveur
  $cnx = mysql_connect( "localhost", "root", "" ) ;
 
  //sélection de la base de données:
  $db  = mysql_select_db( "epst" ) ;
 
  //récupération des valeurs des champs:
  //nom:
  $nom     = $_POST["nom"] ;
  //prenom:
  $prenom = $_POST["prenom"] ;
  //adresse:
  $adresse = $_POST["adresse"] ; 
  //récupération de l'identifiant de la personne:
  $id         = $_POST["id"] ;
 
  //création de la requête SQL:
  $sql = "UPDATE ats
            SET nom         = '$nom', 
	          prenom     = '$prenom',
		  adresse    = '$adresse',
           WHERE id = '$id' " ;
 
  //exécution de la requête SQL:
  $requete = mysql_query($sql, $cnx) or die( mysql_error() ) ;
 
 
  //affichage des résultats, pour savoir si la modification a marchée:
  if($requete)
  {
    echo("La modification à été correctement effectuée") ;
  }
  else
  {
    echo("La modification à échouée") ;
  }
?>
quand je clique sur modifier
un tableau s'affichera
contient le nom prénom et adresse a modifié mais quand je clique sur modifier
il me donne l'erreur suivante et rien ne sera afficher
voici l'erreur
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE id = '1'' at line 5
merci a bientot
fleurrouge est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 12h15   #4
Modératrice
 
Avatar de Celira
 
Femme
Développeuse PHP/Java
Inscription : avril 2007
Messages : 3 678
Détails du profil
Informations personnelles :
Sexe : Femme
Âge : 27
Localisation : France

Informations professionnelles :
Activité : Développeuse PHP/Java

Informations forums :
Inscription : avril 2007
Messages : 3 678
Points : 5 425
Points : 5 425
Visiblement, ta requête SQL échoue. Le plus simple est d'afficher la requête en erreur pour pouvoir la tester réellement dans PhpMyAdmin où quelque chose du genre :
Code :
1
2
//exécution de la requête SQL:
  $requete = mysql_query($sql, $cnx) or die('Erreur sur : '.$sql.'<br/>'. mysql_error() ) ;
__________________
Modératrice PHP
Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)

Pour afficher votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur)
Celira est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 12h20   #5
Membre expérimenté
 
Avatar de amoiraud
 
Homme Adrien
Développeur Web
Inscription : octobre 2006
Messages : 414
Détails du profil
Informations personnelles :
Nom : Homme Adrien
Localisation : France, Rhône (Rhône Alpes)

Informations professionnelles :
Activité : Développeur Web
Secteur : High Tech - Multimédia et Internet

Informations forums :
Inscription : octobre 2006
Messages : 414
Points : 539
Points : 539
Envoyer un message via MSN à amoiraud
Je pense que l'erreur viens de la virgule après ton dernier SET :

Code :
1
2
3
4
5
6
7
 
//création de la requête SQL:
$sql = "UPDATE ats
          SET nom         = '$nom', 
	          prenom     = '$prenom',
		  adresse    = '$adresse',
          WHERE id = '$id' " ;
Enleve la virgule située après le '$adresse' et ca devrait fonctionner
amoiraud est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/02/2012, 15h44   #6
Membre éclairé
 
Avatar de humitake
 
Homme Olivier
Étudiant
Inscription : novembre 2010
Messages : 303
Détails du profil
Informations personnelles :
Nom : Homme Olivier
Âge : 20
Localisation : France

Informations professionnelles :
Activité : Étudiant

Informations forums :
Inscription : novembre 2010
Messages : 303
Points : 384
Points : 384
Bonjour,

Citation:
Envoyé par Celira
A quel moment ça plante ? que se passe-t-il ? Tu obtiens un message d'erreur, une page blanche, ton ordinateur explose ?
Heureusement qu'un bug ne fait pas exploser un PC sinon sa couterai cher d'être développeur

Par contre je t'encourage à utiliser PDO plutôt que les fonction mysql.

Comme indiqué par amoiraud il faut retirer la virgule mais il me semble que ce n'est pas la seule erreur :
Si ton id est un int il ne faut pas mettre les ' sinon tu aura une erreur lors de l'update.
humitake est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 12/02/2012, 11h25   #7
Candidat au titre de Membre du Club
 
Inscription : mars 2009
Messages : 81
Détails du profil
Informations forums :
Inscription : mars 2009
Messages : 81
Points : 10
Points : 10
salut
merci pour l'aide c'est bon le programme de modification sa marche trés bien
mais quand il affiches les personnes (nom et prenom..etc) a lequelquelle je doit modifier un
il les affiche sous formes des lignes
par exemple
nom prenom modifier
mais ce que je veux sous forme d'un tableau qui contient le nom et le prenom et modifier
j'éspére qu'il ya quelqu'un qui peux m'aidé
merci d'avance
A Bientot
fleurrouge est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 18h49.


 
 
 
 
Partenaires

Hébergement Web