Bonjour à tous,
Pouvez vous m'expliquer comment avec PDO je peux réaliser plusieurs requêtes?
je récupère certaines infos dans ma BDD, via $lof
une fois récupéré je souhaiterai créer une requête qui va chercher dans ma colonne Plof l'information et qui me donne le résultat.
Je m'explique :
Ma BDD
Je souhaiterais récupérer ce qu'il y a-dans la colonne PLOF sur une ligne x et répéter ma boucle
exemple:
le résultat de mon formulaire est 617323, les infos de cette ligne s'affichent puis je souhaiterais récupérer les infos sur cette ligne dans la case "Plof" et qu'elle me renvoie les infos.
Pour le moment j'arrive à récupérer les infos du résultat de mon formulaire mais je ne sais pas comment récupérer sur la meme ligne les infos d'une case et recommencer ma boucle
Merci à tous
Voici ce que j'ai fait:
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
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 <?php include('./connexion.php'); header("Content-Type: text/html; charset=utf-8"); if (!empty($_POST)) { $lof = $_POST['lof']; // ------------------------- // requete : lof $lof_query = "SELECT *". " FROM chiens ". " WHERE LOF like :lof;"; try { $pdo_select = $pdo->prepare($lof_query); $pdo_select->execute( array( ':lof' => $lof )); $lof_nombre = $pdo_select->rowCount(); $lof_rowAll = $pdo_select->fetchAll(); } catch (PDOException $e) { echo 'Erreur SQL : '. $e->getMessage().'<br/>'; die(); } // ------------------------- if($lof_nombre>0) { // boucle pour lister foreach ($lof_rowAll as $lof_row) { echo '<p><h5 class="ti">RENSEIGNEMENTS SUR LE CHIEN</h5><p>'; if ($lof_row['LOF']>0) { echo '<p><span class="a">Lof:</span> '.$lof_row['LOF'].''; } if (!empty($lof_row['NOM'])) { echo ' <span class="a"> Nom:</span> '.$lof_row['NOM'].''; } if (!empty($lof_row['AFF'])) { echo' <span class="a">Affixe:</span> '.$lof_row['AFF'].'<p>'; } if (!empty($lof_row['DNAIS'])) { echo '<p><span class="a">Date de Naissance:</span> '.$lof_row['DNAIS'].''; } if (!empty($lof_row['SEX'])) { echo ' <span class="a">Sexe:</span> '.$lof_row['SEX'].''; } if (!empty($lof_row['TAT'])) { echo ' <span class="a">Tatouage:</span> '.$lof_row['TAT'].''; } if (!empty($lof_row['PUC'])) { echo ' <span class="a">Puce:</span> '.$lof_row['PUC'].'<p>'; } if (!empty($lof_row['RADH'])) { echo '<p><span class="a">Radio des Hanches:</span> '.$lof_row['RADH'].''; } if (!empty($lof_row['NRADH'])) { echo ' <span class="a">Note:</span> '.$lof_row['NRADH'].'<p>'; } if (!empty($lof_row['RADC'])) { echo '<p><span class="a">Radio des Coudes:</span> '.$lof_row['RADC'].''; } if (!empty($lof_row['NRADC'])) { echo ' <span class="a">Note:</span> '.$lof_row['NRADC'].'<p>'; } if (!empty($lof_row['TRES'])) { echo '<p><span class="a"a>Résultat Travail:</span> '.$lof_row['TRES'].'<p>'; } echo '<p><h6 class="ta">RENSEIGNEMENTS SUR LE PÈRE</h6><p>'; if (!empty($lof_row['PLOF'])) { echo '<p><span class="a">Lof:</span> '.$lof_row['PLOF'].''; } if (!empty($lof_row['PNOM'])) { echo ' <span class="a">Nom et affixe:</span> '.$lof_row['PNOM'].''; } if (!empty($lof_row['PRES'])) { echo ' <span class="a">Résultat:</span> '.$lof_row['PRES'].'<p>'; } if (!empty($lof_row['PRAD'])) { echo '<p><span class="a">Radiographie:</span> '.$lof_row['PRAD'].'<p>'; } echo '<p><h6 class="ta">RENSEIGNEMENTS SUR LE MÈRE</h6><p>'; if (!empty($lof_row['MLOF'])) { echo '<p><span class="a">Lof:</span> '.$lof_row['MLOF'].''; } if (!empty($lof_row['MNOM'])) { echo ' <span class="a">Nom et affixe:</span> '.$lof_row['MNOM'].''; } if (!empty($lof_row['MRES'])) { echo ' <span class="a">Résultat:</span> '.$lof_row['MRES'].'<p>'; } if (!empty($lof_row['MRAD'])) { echo '<p><span class="a">Radiographie:</span> '.$lof_row['MRAD'].'<p>'; } if (!empty($lof_row['PROP'])) { echo '<p><h6 class="ta">PROPRIÉTAIRE</h6><p>'; echo '<p><span class="a">Nom:</span> '.$lof_row['PROP'].''; } if (!empty($lof_row['PREN'])) { echo ' <span class="a">Prénom:</span> '.$lof_row['PREN'].'<p>'; } if (!empty($lof_row['ADR1'])) { echo '<p><span class="a">Adresse:</span> '.$lof_row['ADR1'].'<p>'; echo '<p> '.$lof_row['CP'].' '.$lof_row['VIL'].'<p>'; if (!empty($lof_row['ELEV'])) { echo '<p><h6 class="ta">ÉLEVEUR</h6><p>'; echo '<p><span class="a">Nom:</span> '.$lof_row['ELEV'].'<p>'; } } } }else { echo '<p>Rien trouvé...<p>'; } }
Partager