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
| if (!isset($_GET['debut'])) $_GET['debut'] = 0;
$nb_affichage_par_page = 1;
// Préparation de la requête avec le LIMIT
$sql1 = 'SELECT accontact, description, activite, dates, tarifs, horaires, adresse, adresse2, cp, ville, s_nom, datemodif, acciv, actel, acemail, commentaire FROM aide_ac, aide_st where aide_ac.structure=aide_st.s_clef';
//if mot--------------(ce qui pose problème)-----
if (isset($_SESSION['mot'])&&($_SESSION['mot'])!="")
{
$_SESSION['mot'] = explode(" ",$_SESSION['mot']);
// On compte le nombre de mots entrés par le visiteur
$_SESSION['nbr_mot'] = count($_SESSION['mot'] );
$sql1 .= ' AND (accontact LIKE "%'.strtolower($_SESSION['mot'][0]).'%" OR description LIKE "%'.strtolower($_SESSION['mot'][0]).'%" OR lieu LIKE "%'.strtolower($_SESSION['mot'][0]).'%")';
$i = "1";
while ($i<$_SESSION['nbr_mot'])
{
// On specifie la methode OR ou AND et on recherche
$sql .= ''.$_SESSION['methode'].' (accontact LIKE "%'.strtolower($_SESSION['mot'][i]).'%"
OR description LIKE "%'.strtolower($_SESSION['mot'][i]).'%"
OR lieu LIKE "%'.strtolower($_SESSION['mot'][i]).'%")';
// On increment la variable $i
$i++;
}
}//fin IF mot-------------------------------
if (isset($_SESSION['public'])&&($_SESSION['public'])!="Choisir une activité dans la liste")
{
$sql1 .= ' AND public = "'.$_SESSION['public'].'"';
}
$sql1 .=' ORDER BY activite ASC LIMIT '.$_GET['debut'].','.$nb_affichage_par_page;
// on exécute la requête
$req1 = mysql_query($sql1) or die('Erreur SQL !<br />'.$sql.'<br />'.mysql_error());
// on va scanner tous les tuples un par un
while ($data = mysql_fetch_array($req1))
{
// on affiches les résultats dans la <table>
echo '<tr><td class="txtgo" width="20%">Organisateur</td><td class="txtp" colspan="3" align="left">', stripslashes(htmlentities(trim($data['s_nom']))) , '</td>';
// on affiche la barre
echo '<tr><td colspan="4" class="txtp" align="left" class="txtp"><br>Voir les autre(s) réponse(s) '.barre_navigation($nb_total, $nb_affichage_par_page, $_GET['debut'], 5).'</td></table>';
}//fin du if WHILE |
Partager