Bonjour,

j ai un fichier php qui me pemret d afficher les champs qui sont sur deux tables de ma base trier par premiere lettre

j ai fait un if pour afficher un message quand il n y a aucune entrees trouvé

mais ce message s affiche sur toutes les pages meme celle ou il n ya rien

Merci


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
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Catalogue</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body link="#000000" vlink="#FFFFFF" alink="#FFFFFF">
<div id="body">
<div id="menu-container"><b>
<a href="label.php?lettre=[0-9]" class="active"><span class="text">0-9</span></a> |
<a href="label.php?lettre=A" target="_self"><span class="text">A</span></a> |
<a href="label.php?lettre=B" target="_self"><span class="text">B</span></a> |
<a href="label.php?lettre=C" target="_self"><span class="text">C</span></a> |
<a href="label.php?lettre=D" target="_self"><span class="text">D</span></a> |
<a href="label.php?lettre=E" target="_self"><span class="text">E</span></a> |
<a href="label.php?lettre=F" target="_self"><span class="text">F</span></a> |
<a href="label.php?lettre=G" target="_self"><span class="text">G</span></a> |
<a href="label.php?lettre=H" target="_self"><span class="text">H</span></a> |
<a href="label.php?lettre=I" target="_self"><span class="text">I</span></a> |
<a href="label.php?lettre=J" target="_self"><span class="text">J</span></a> |
<a href="label.php?lettre=K" target="_self"><span class="text">K</span></a> |
<a href="label.php?lettre=L" target="_self"><span class="text">L</span></a> |
<a href="label.php?lettre=M" target="_self"><span class="text">M</span></a> |
<a href="label.php?lettre=N" target="_self"><span class="text">N</span></a> |
<a href="label.php?lettre=O" target="_self"><span class="text">O</span></a> |
<a href="label.php?lettre=P" target="_self"><span class="text">P</span></a> |
<a href="label.php?lettre=Q" target="_self"><span class="text">Q</span></a> |
<a href="label.php?lettre=R" target="_self"><span class="text">R</span></a> |
<a href="label.php?lettre=S" target="_self"><span class="text">S</span></a> |
<a href="label.php?lettre=T" target="_self"><span class="text">T</span></a> |
<a href="label.php?lettre=U" target="_self"><span class="text">U</span></a> |
<a href="label.php?lettre=V" target="_self"><span class="text">V</span></a> |
<a href="label.php?lettre=W" target="_self"><span class="text">W</span></a> |
<a href="label.php?lettre=X" target="_self"><span class="text">X</span></a> |
<a href="label.php?lettre=Y" target="_self"><span class="text">Y</span></a> |
<a href="label.php?lettre=Z" target="_self"><span class="text">Z</span></a></b>
</div>
 
<?php
 
include ('config.php');
include ('connexion.php');
 
echo '<table>

<tr>

<th>Label</th>
<th>Référence</th>
<th>Artiste</th>
<th>Album</th>
<th>Format</th>
<th>Modifier</th>
<th>Supprimer</th>

</tr>';
 
// paramètre reçu désignant le critère du nom du label recherché
$param1 = mysql_real_escape_string($_GET['lettre']);
 
 
//
$sql = "SELECT * FROM label
INNER JOIN contenu ON contenu.id_label = label.id_label
Where nom_label REGEXP '^$param1' order by nom_label, reference;
";
$req = mysql_query($sql);
while ($resultat = mysql_fetch_array($req))
 
 
{
echo '<tr>';
 
 
echo '<td>'.$resultat['nom_label'].'</td>';
echo '<td>'.$resultat['reference'].'</td>';
echo '<td>'.$resultat['artiste'].'</td>';
echo '<td>'.$resultat['album'].'</td>';
echo '<td>'.$resultat['format'].'</td>';
echo '<td><a href="formulaire_de_mise_a_jour.php?reference='.$resultat
 
['reference'].'">Modifier</a></td>';
echo '<td><a href="script_de_suppression.php?reference='.$resultat
 
['reference'].'">Supprimer</a></td>';
 
 
 
 
 
echo '</tr>';
}
 
echo '</table>';
 
$var = $resultat;
 
if($var == null)
 
{
 
 
echo ('<p align="center"> "Aucune référence trouvée" </p>');
 
 
}
 
?>
 
<div id="cat-footer"></div>
 
</body></html>
 
<?php
mysql_close();
?>