Voilà j'ai un probleme d'insertion je comprend pas pkoi pourtant les POST son tous bon et aucune info s'enregistre dans la base.
Pouvez vous me dire pour quel raison cela ne s'enregistre pas dans SQL
Le formulaire :
Le formulaire InsertCode:
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 <div align="center" class="cachediv" id="rub6"><br> <form method="POST" action="index.php?page=9&pages=produit"> <table border="0" align="center" bgcolor="cccccc" width="40%"> <tr bgcolor='white'> <td width="70"> <p align="left">Référence :</td> <td><input type="text" name="ref" ></td> </tr> <tr bgcolor='white'> <td width="70">Désignation :</td> <td><input type="text" name="des" ></td> </tr> <?php $connection = mysql_connect("$sql_serveur","$sql_login","$sql_pass"); // test la connection if ( ! $connection ) die ("connection impossible"); // Connecte la base mysql_select_db($sql_bdd) or die ("pas de connection"); $select = "SELECT * FROM rayon"; $result = mysql_query($select,$connection) or die ('Erreur : '.mysql_error() ); ?> <tr bgcolor='white'> <td width="5">Rayon Produit :</td> <td><SELECT name="rayon"> <?php while ( $row = mysql_fetch_array( $result)) { $rayon = $row["rayon"]; ?> <OPTION VALUE="<?php echo $rayon; ?>"><?php echo "$rayon"; ?></OPTION> <?php } ?> </SELECT> </tr> <?php $connection = mysql_connect("$sql_serveur","$sql_login","$sql_pass"); // test la connection if ( ! $connection ) die ("connection impossible"); // Connecte la base mysql_select_db($sql_bdd) or die ("pas de connection"); $select = "SELECT * FROM categorie"; $result = mysql_query($select,$connection) or die ('Erreur : '.mysql_error() ); ?> <tr bgcolor='white'> <td width="5">Catégorie :</td> <td><SELECT name="categorie"> <?php while ( $row = mysql_fetch_array( $result)) { $categorie = $row["categorie"]; ?> <OPTION VALUE="<?php echo $categorie; ?>"><?php echo "$categorie"; ?></OPTION> <?php } ?> </SELECT> </tr> <tr bgcolor='white'> <td width="70">Prix Unitaire :</td> <td><input type="text" name="prix" ></td> </tr> <td><input type="hidden" name="login_soc" value="<?php echo $pseudo;?>"></td> <tr bgcolor='white'> <td><input type="submit" value="Envoyer" name="B3"></td> </tr> </table> </form> </div>
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 <?php if(!isset($_SESSION['pseudo'])) { echo "<script language='javascript'>document.location='index.php?page=1'</script>"; } ?> <?php require("conf.php"); $login_soc = $_POST['login_soc']; $ref = $_POST['ref']; $des = $_POST['des']; $rayon $_POST['rayon']; $categorie = $_POST['categorie']; $prix = $_POST['prix']; $connection = mysql_connect("$sql_serveur","$sql_login","$sql_pass"); // test la connection if ( ! $connection ) die ("connection impossible"); // Connecte la base mysql_select_db($sql_bdd) or die ("pas de connection"); //création de la requête SQL: /*mysql_query("INSERT INTO article (ref, des, rayon, categorie, prix, login_soc) VALUES ('$ref', '$des', '$rayon', '$categorie', '$prix', '$login_soc')");*/ mysql_query("INSERT INTO article (login_soc, ref, des, rayon, categorie, prix) VALUES ('$login_soc', '$ref', '$des', '$rayon', '$categorie', '$prix')"); echo '<script type="text/javascript"> window.location.href = "index.php?page=9&pages=gererarticle"; </script>'; ?>