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
|
<?
include("../../conf/confcau.php");
$cat=$_POST['cat'];
$scat=$_POST['scat'];
$req1="SELECT nom,tel1,tel2,code,num_abr,telprive,url,com FROM annuaire WHERE cat LIKE '$cat'";
$req2="SELECT nom,tel1,tel2,code,num_abr,telprive,url,com FROM annuaire WHERE cat LIKE '$cat' AND scat LIKE '$scat'";
if($scat == "selection..."){
$result = mysql_query($req1) or die("req1 impossible");
}else{
$result = mysql_query($req2) or die("req2 impossible");
}
if (!mysql_fetch_row($result)) {
//si pas de resultat
echo "<SCRIPT language=\"JavaScript\">\n
alert('Aucun enregistrement ne correspond');
</script>";
}
else {
echo "cat : ".$cat."<br>";
echo "scat : ".$scat."<br><br>";
// Recuperation des resultats
echo "<table border='1'>";
echo "<th>NOM</th>\n";
echo "<th>TEL1</th>\n";
echo "<th>TEL2</th>\n";
echo "<th>CODE</th>\n";
echo "<th>NUM. ABR.</th>\n";
echo "<th>TEL PRIV.</th>\n";
echo "<th>Commentaire</th>\n";
echo "<th>URL</th>\n";
$inc=0;
while($row = mysql_fetch_row($result)){
//on recupere les valeurs
$nom= $row[0];
$tel1= $row[1];
$tel2 = $row[2];
$code = $row[3];
$num_abr = $row[4];
$telprive = $row[5];
$url = $row[6];
$com = $row[7];
if($tel1 == "" or $tel1 == NULL){
$tel1=" - ";
}
if($tel2 == "" or $tel2 == NULL){
$tel2=" - ";
}
if($code == "" or $code == NULL){
$code=" - ";
}
if($num_abr == "" or $num_abr == NULL){
$num_abr=" - ";
}
if($telprive == "" or $telprive == NULL){
$telprive=" - ";
}
if($com == "" or $com == NULL){
$com=" - ";
}
if($inc%2 == 1){
$color="lightgreen";
}else{
$color="white";
}
//affichage du tableau des resultats
echo "<tr bgcolor='$color'>\n
<td>$nom</td>\n
<td>$tel1</td>\n
<td>$tel2</td>\n
<td>$code</td>\n
<td>$num_abr</td>\n
<td>$telprive</td>\n
<td>$com</td>\n";
if($url != NULL)
{echo "<td><a href=\"$url\">lien</a></td>\n";}
else
{echo "<td> - </td>\n";}
echo "</tr>\n";
$inc++;
}
echo "</table>";
}
//Deconnexion de la base de donnees
mysql_close();
?> |
Partager