Bonjour développeur,
pour commencer ... la BDD j'ai 3 tables :
port_relation
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 `IDPERSREL` int(11) NOT NULL, `IDPORTFOLIOREL` int(11) NOT NULL,
port_portfolio
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14 `IDPORTFOLIO` int(11) NOT NULL AUTO_INCREMENT, `text1` text NOT NULL, `text2` text NOT NULL, `text3` text NOT NULL, `text4` text NOT NULL, `text5` text NOT NULL, `text6` text NOT NULL, `img1` text NOT NULL, `img2` text NOT NULL, `img3` text NOT NULL, `img4` text NOT NULL, `img5` text NOT NULL, `img6` text NOT NULL, PRIMARY KEY (`IDPORTFOLIO`)
port_pers
Code sql : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 `IDPERS` int(11) NOT NULL AUTO_INCREMENT, `prenom` text NOT NULL, `login` text NOT NULL, PRIMARY KEY (`IDPERS`)
J'ai ma requête :
j'ai ensuite dans mon code HTML, un formulaire qui permet de modifier les liens des images (port_portfolio.img) et les titres (port_portfolio.text).
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 $modifier_images = mysql_query(" SELECT port_portfolio.IDPORTFOLIO AS IDPORTFOLIO, port_portfolio.img1, port_portfolio.img2, port_portfolio.img3, port_portfolio.img4, port_portfolio.img5, port_portfolio.img6, port_portfolio.text1, port_portfolio.text2, port_portfolio.text3, port_portfolio.text4, port_portfolio.text6, port_portfolio.text5, port_relation.IDPORTFOLIOREL AS IDPORTFOLIOREL, port_relation.IDPERSREL AS IDPERSREL, port_pers.IDPERS AS IDPERS, port_pers.login AS login FROM port_portfolio LEFT OUTER JOIN port_relation ON IDPORTFOLIO = IDPORTFOLIOREL INNER JOIN port_pers ON IDPERS = IDPERSREL WHERE login='".$login."' "); //$login étant le login en session
Le problème c'est que j'ai des chiffres après img et text de 1 à 6, j'aimerais (pour limiter le code) pouvoir faire des indices, c'est à dire que quand quelqu'un veut modifier l'image en question il clique sur un lien (requête GET) et sa le renvoie vers le formulaire avec comme identifiant img[x] pour pouvoir modifier dans la BDD ...
j'ai commencé avec cela :
j’espère avoir été assez explicite ... merci de votre aide !
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 <table border="1"> <tr> <th>Modifier l'image et son texte</th> </tr> <?PHP while ($mi = mysql_fetch_array($modifier_images)) { $id1 = $mi['text1']; $id2 = $mi['text2']; $id3 = $mi['text3']; $id4 = $mi['text4']; $id5 = $mi['text5']; $id6 = $mi['text6']; echo '<tr>'; echo '<td><a href="index.php?modifier=ok&id='.$id1.'">'.$id1.'</a>' . '</td>'; //?modifier=ok renvoie vers le formulaire de modification echo '<td><a href="index.php?modifier=ok&id='.$id2.'">'.$id2.'</a>' . '</td>'; echo '<td><a href="index.php?modifier=ok&id='.$id3.'">'.$id3.'</a>' . '</td>'; echo '<td><a href="index.php?modifier=ok&id='.$id4.'">'.$id4.'</a>' . '</td>'; echo '<td><a href="index.php?modifier=ok&id='.$id5.'">'.$id5.'</a>' . '</td>'; echo '<td><a href="index.php?modifier=ok&id='.$id6.'">'.$id6.'</a>' . '</td>'; echo '</tr>'; } ?> </table>
Partager