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
| case 'annonce':
if(!empty($_GET['i_emetteur_ann'])) {
$param1 = ' id_auteur_annonce in (';
//recuperer les id auteur correspondant au nom saisi
$rs_au = mysql_query('select id_user from users where login like "%'.$_GET['i_emetteur_ann'].'%"') or die("Erreur code 00506");
while($tb_au = mysql_fetch_array($rs_au)) {
$param1 = $param1.$tb_au[0].',';
}
$prem = 'oui';
$param1 = substr($param1, 0, -1).')';
}
else $param1="";
if(!empty($_GET['i_titre_ann'])) {
$param2 = ' titre_annonce like "%'.$_GET['i_titre_ann'].'%"';
if($prem=='oui')
$param2 = ' and '.$param2;
$prem = 'oui';
}
else $param2="";
if(!empty($_GET['i_texte_ann'])) {
$param3 = ' texte_annonce like "%'.$_GET['i_texte_ann'].'%"';
if($prem=='oui')
$param3 = ' and '.$param3;
$prem = 'oui';
}
else $param3="";
if(!empty($_GET['i_datcre_ann'])) {
$param4 = ' date_creation ="'.$_GET['i_datcre_ann'].'"';
if($prem=='oui')
$param4 = ' and '.$param4;
$prem = 'oui';
}
else $param4="";
if(!empty($_GET['i_datlim_ann'])) {
$param5 = ' date_limite ="'.$_GET['i_datlim_ann'].'"';
if($prem=='oui')
$param5 = ' and '.$param5;
$prem = 'oui';
}
else $param5="";
if(!empty($_GET['i_type_ann'])) {
$param6 = ' type_ann="'.$_GET['i_type_ann'].'"';
if($prem=='oui')
$param6 = ' and '.$param6;
$prem = 'oui';
}
else $param5="";
//controle que l'on a au moins un champ rempli, sinon on ne filtre pas (a cause erreur due a la clause where)
$test = $param1.$param2.$param3.$param4.$param5.$param6;
if(!empty($test))
$rq1 = 'select * from annonces where'.$param1.$param2.$param3.$param4.$param5.$param6;
else $rq1 = 'select * from annonces';
$rs = mysql_query($rq1) or die("Erreur code 00507");
$i=1;
//affichage des données
echo '<script type="text/javascript" src="./js/thickbox.js"></script>';
echo '<table style="border-style:solid; border-width:1px; width:100%;">';
echo ' <tr style="border-style:solid; border-width:1px;">';
echo ' <th>No</th>';
echo ' <th>Date création</th>';
echo ' <th>Titre</th>';
echo ' <th>Date limite</th>';
echo ' <th>Répondre</th>';
echo ' </tr>';
while($tb = mysql_fetch_array($rs)) {
echo '<tr style="border-width:1px; border-style:solid;">';
echo '<td>'.$i.'</td>';
echo '<td><center>'.$tb[4].'</center></td>';
echo '<td><a href="aff_ann.php?idan='.$tb[0].'&keepThis=true&TB_iframe=true&height=300&width=600" title="Lire une annonce" class="thickbox" target="_blank">'.$tb[2].'</a></td>';
echo '<td><center>'.$tb[5].'</center></td>';
echo '<td colspan="2"><center><a href="index.php?page=repannrech&c='.$tb[1].'&a='.$tb[0].'">Répondre</a></center></td>';
echo '</tr>';
$i=$i+1;
}
echo '</table>';
break; |
Partager