bonjour a tt
deux table:
produit :"id_produit"
film :"id_film"
on veut modifier les champs de ces table voila le code
affichage :
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 <?php $host = 'localhost'; // serveur $user = 'root'; // identifiant $mdp = ''; // mot de passe $base = 'ruspina'; // nom de la base // Connexion au serveur mysql_connect($host, $user, $mdp) or die('Impossible de se connecter au serveur '.$host); // Sélection d'une base mysql_select_db($base) or die('Impossible de sélectionner la base '.$base); $result = mysql_query("select * from produit where type=\"film\" ") or die ("Execution impossible de la requete"); $nb1=mysql_num_rows($result); $result1 = mysql_query("select * from film") or die ("Execution impossible de la requete"); $nb2=mysql_num_rows($result1); ?> <table width="169%" border="1"> <tr> <td colspan="14"><div align="center"> <p><img src="image/CATHALOGEFILM.png" width="641" height="139" /></p> </div></td> </tr> <tr> <td width="8%"><span class="Style1">ID_PRODUIT</span></td> <td width="4%"><span class="Style1">TITRE</span></td> <td width="4%"><span class="Style2">ICONE</span></td> <td width="6%"><span class="Style2">POSTURE</span></td> <td width="10%"><span class="Style2"> SYSTEME EXPLOITATION</span> </td> <td width="5%"><span class="Style2">ANNEÉ</span></td> <td width="8%"><span class="Style2">REFERENCE</span></td> <td width="3%"><span class="Style2">PRIX</span></td> <td width="4%"><span class="Style2">POIDS</span></td> <td width="9%"><span class="Style2">REALISATEUR</span></td> <td width="5%"><span class="Style2">ACTEUR</span></td> <td width="6%"><span class="Style2">LANGUE</span></td> <td width="6%"><span class="Style2">ORIGINE</span></td> <td width="12%"><span class="Style2">DUREE</span></td> </tr> <?php if($nb1>0 || $nb2>0) { for($i=0;$i<$nb1;$i++) { $ligne = mysql_fetch_array($result); $ligne2 = mysql_fetch_array($result1); ?> <tr> <td><div align="center"><?php echo $ligne['id_produit']; ?> </div></td> <td><div align="center"><?php echo $ligne['titre']; ?> </div></td> <td><div align="center"> <?php echo $ligne['icone']; ?></div></td> <td><div align="center"><?php echo $ligne['posture']; ?></div></td> <td><div align="center"><?php echo $ligne['systeme_exploitation']; ?> </div></td> <td><div align="center"><?php echo $ligne['annee']; ?> </div></td> <td><div align="center"><?php echo $ligne['reference']; ?> </div></td> <td><div align="center"><?php echo $ligne['prix']; ?> </div></td> <td><div align="center"><?php echo $ligne['poids']; ?> </div></td> <td><div align="center"><?php echo $ligne2['realisateur']; ?> </div></td> <td><div align="center"><?php echo $ligne2['acteur']; ?> </div></td> <td><div align="center"><?php echo $ligne2['langue']; ?> </div></td> <td><div align="center"><?php echo $ligne2['origine']; ?> </div></td> <td><div align="center"><?php echo $ligne2['duree']; ?> </div></td> <td width="10%"><a href="action_supprimer_film.php?pg=<?php echo $ligne[id_produit]; ?>">Supprimer</a></td> <td width="10%"><a href="modifier_film.php?tyty=<?php echo $ligne[id_produit]; ?>">Modifier</a></td> <?php }} ?>
lien vers cette page:Code:<a href="modifier_film.php?tyty=<?php echo $ligne[id_produit]; ?>">Modifier</a>
action de cette page: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 <body > <p class="Style1 Style3 Style5">modifier un film :</p> <form name="form1" id="form1" method="post" enctype="multipart/form-data" action="action_modifier_film.php"> <table width="52%" align="center" border="1"background="image/fontpg.jpg"> <tr> <td width="23%" height="40">titre:</td> <td width="77%"><input name="titre" type="text" id="titre" width="332" /></td> </tr> <tr> <td width="23%" height="40">type:</td> <td><input name="type" type="text" id="type" width="332" /></td> </tr> <tr> <td width="23%" height="40">icone:</td> <td><label> <input name="icone" type="file" id="icone" /> </label></td> </tr> <tr> <td width="23%" height="40">posture:</td> <td><label> <input name="posture" type="file" id="posture" /> </label></td> </tr> <tr> <td width="23%" height="40">systeme exploitation : </td> <td><input name="se" type="text" id="sys" width="332" /></td> </tr> <tr> <td width="23%" height="40">année:</td> <td><input name="annee" type="text" id="ann" width="332" /></td> </tr> <tr> <td width="23%" height="40">reference:</td> <td><input name="ref" type="text" id="ref" width="332" /></td> </tr> <tr> <td width="23%" height="40">realisateur:</td> <td><input name="real" type="text" id="rea" width="332" /></td> </tr> <tr> <td width="23%" height="40">acteur:</td> <td><input name="acteur" type="text" id="act" width="332" /></td> </tr> <tr> <td width="23%" height="40">langue:</td> <td><input name="lang" type="text" id="lan" width="332" /></td> </tr> <tr> <td width="23%" height="40">origine:</td> <td><input name="origine" type="text" id="or" width="332" /></td> </tr> <tr> <td width="23%" height="40">durée:</td> <td><input name="duree" type="text" id="dur" width="332" /></td> </tr> <tr> <td width="23%" height="40">prix:</td> <td><input name="prix" type="text" id="pri" width="332" /></td> </tr> <td width="23%" height="40">poids:</td> <td><input name="poid" type="text" id="poid" width="332" /></td> </table> <br /> <p align="center"> <label> <input type="submit" name="Submit" value="Modifier" /> </label> <input type="reset" name="annuler" value="retablir" /> </p> </form> </body>
bon la probleme je veux quand je clique sur modifier d'un ligne, les données seront affiché dans la page de modification et aprés avoir le modifié elle sera affiché dans premier table(resultat).je crois que mon probleme est au niveau de memoriser id_produit quand je veux modifier un ligne plus la probleme de sessionCode:
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 <?php if(isset($_GET['tyty'])) { $enregistrer_sous1 = 'D:\MARWEN\TRI 3\videotheque\ruspina\images'; $enregistrer_sous2 = 'D:\MARWEN\TRI 3\videotheque\ruspina\images'; $tmp_fichier1 = $_FILES['icone']['tmp_name']; $type_fichier1 = $_FILES['icone']['type']; $nom_fichier1 = $_FILES['icone']['name']; $tmp_fichier2 = $_FILES['posture']['tmp_name']; $type_fichier2 = $_FILES['posture']['type']; $nom_fichier2 = $_FILES['posture']['name']; move_uploaded_file($tmp_fichier1, $enregistrer_sous1 . $nom_fichier1); move_uploaded_file($tmp_fichier2, $enregistrer_sous2 . $nom_fichier2); $connexion=mysql_connect('localhost','root','') or die ("connexion impossible."); $db=mysql_select_db('ruspina',$connexion) or die ("base de données non accessible"); $a= $_POST['titre']; $z=$_FILES['icone']['name']; $e=$_FILES['posture']['name']; $r=$_POST['se']; $t=$_POST['annee']; $y=$_POST['ref']; $u=$_POST['real']; $o=$_POST['acteur']; $p=$_POST['lang']; $q=$_POST['origine']; $s=$_POST['duree']; $d=$_POST['prix']; $f=$_POST['poid']; $g=$_POST['type']; $id=$_GET['tyty']; $req="update produit set id_produit='$id',type='$g',titre='$a',icone='$z',posture='$e', systeme_exploitation='$r',annee='$t',reference='$y',prix='$d',poids='$f'"; $res=mysql_query($req); if(!$res) { echo"insertion d'un nouveau element evec succe"; } else { echo"probleme"; } } ?>
svp aider moi
je vous remercie