Bonjour à tous , j'aimerai de l'aide pour réalise se que je veut mais j'ai un problème pour effectuer la requête.

BUT : Ajouter membre

Insertion.php (forumulaire)

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
54
55
56
57
58
59
60
61
62
63
 
<html>
<body>
<form name="insertion" action="insertion2.php" method="POST">
  <table border="0" align="center" cellspacing="2" cellpadding="2">
    <tr align="center">
      <td>Pseudo</td>
      <td><input type="text" name="pseudo"></td>
    </tr>
    <tr align="center">
      <td>Password</td>
      <td><input type="text" name="mdp"></td>
    </tr>
    <tr align="center">
      <td>Email</td>
      <td><input type="text" name="email"></td>
    </tr>
    <tr align="center">
      <td>MSN</td>
      <td><input type="text" name="msn"></td>
    </tr>
 
    <tr align="center">
      <td>Site Web</td>
      <td><input type="text" name="siteweb"></td>
    </tr>
 
 
    <tr align="center">
      <td>Avatars</td>
      <td><input type="text" name="avatar"></td>
    </tr>
 
    <tr align="center">
      <td>Signature</td>
      <td><input type="text" name="signature"></td>
    </tr>
 
    <tr align="center">
      <td>Localisations</td>
      <td><input type="text" name="localisation"></td>
    </tr>
 
 
    <tr align="center">
      <td>Inscrits depuis</td>
      <td><input type="text" name="inscrit"></td>
    </tr>
 
 
    <tr align="center">
      <td>Droits d'accès</td>
      <td><input type="text" name="rang"></td>
    </tr>
 
 
    <tr align="center">
      <td colspan="2"><input type="submit" value="insérer"></td>
    </tr>
  </table>
</form>
</body>
</html>

Insertion2.php (Requête)

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
54
55
<?php
  //connection au serveur
  $cnx = mysql_connect( "xxxxx", "xxxx", "xxxx" ) ;
 
  //sélection de la base de données:
  $db  = mysql_select_db( "xxxx" ) ;
 
//récupération des valeurs des champs:
  //Pseudo:
  $membre_pseudo = $_POST["pseudo"] ;
 
  //MDP:
  $membre_mdp = $_POST["mdp"] ;
 
  //Email:
  $membre_email = $_POST["email"] ;
 
  //MSN:
  $membre_msn = $_POST["msn"] ;
 
  //SiteWeb:
  $membre_siteweb = $_POST["siteweb"] ;
 
  //Avatar:
  $membre_avatar = $_POST["avatar"] ;
 
  //Signature:
  $membre_signature = $_POST["signature"] ;
 
 
  //Localisation:
  $siteweb      = $_POST["localisation"] ;
 
  //inscrit:
  $siteweb      = $_POST["localisation"] ;
 
 
 
  $sql = "INSERT INTO `forum_membres` (`membre_pseudo`, `membre_mdp`, `membre_email`, `membre_msn`, `membre_siteweb`, `membre_avatar`, `membre_signature`, `membre_localisation`, `membre_inscrit`, `membre_post`) 
VALUES ('$membre_pseudo', '$membre_mdp', '$membre_email', '$membre_msn', '$membre_siteweb', '$membre_avatar', '$membre_signature', '$membre_localisation', '$membre_inscrit', '$membre_rang', '$membre_post') " ;
 
 
  //exécution de la requête SQL:
  $requete = mysql_query($sql, $cnx) or die( mysql_error() ) ;
 
  //affichage des résultats, pour savoir si l'insertion a marchée:
  if($requete)
  {
    echo("L'insertion a été correctement effectuée") ;
  }
  else
  {
    echo("L'insertion à échouée") ;
  }
?>







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
CREATE TABLE IF NOT EXISTS `forum_membres` (
  `membre_id` int(11) NOT NULL auto_increment,
  `membre_pseudo` varchar(30) collate latin1_general_ci NOT NULL,
  `membre_mdp` varchar(32) collate latin1_general_ci NOT NULL,
  `membre_email` varchar(250) collate latin1_general_ci NOT NULL,
  `membre_msn` varchar(250) collate latin1_general_ci NOT NULL,
  `membre_siteweb` varchar(100) collate latin1_general_ci NOT NULL,
  `membre_avatar` varchar(100) collate latin1_general_ci NOT NULL,
  `membre_signature` varchar(200) collate latin1_general_ci NOT NULL,
  `membre_localisation` varchar(100) collate latin1_general_ci NOT NULL,
  `membre_inscrit` int(11) NOT NULL,
  `membre_derniere_visite` int(11) NOT NULL,
  `membre_rang` tinyint(4) default '2',
  `membre_post` int(11) NOT NULL,
  PRIMARY KEY  (`membre_id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=2 ;