Exemple #1
0
 // Récuperation du nom du champ correspondant a l'identifiant
 // contenu dans $champ_recherche[$i][$j]
 $tmp = $champ_recherche[$i][$j];
 $nom1 = 'nom_champ_moteur_de_recherche';
 $nom1bis = 'table_moteur_de_recherche';
 $nom2 = $module_table . '_moteur_de_recherche';
 $nom3 = 'id_moteur_de_recherche';
 $sql = " SELECT {$nom1},{$nom1bis}\n                             FROM {$nom2}\n                             WHERE {$nom3} =' {$tmp}'";
 //$res= DatabaseOperation::query($sql)or die('Erreur SQL !'.$sql.'<br>'.mysql_error()) ;
 $res = DatabaseOperation::convertSqlStatementKeyAndOneFieldToArray($sql);
 //nom du champ
 foreach ($res as $champ) {
     // recuperation des jointures
     //echo         $GLOBALS['table_champ_retour'];  // table du champ retour
     //echo        $GLOBALS['table_tous_champs_rech'];
     $join[$j] = MoteurDeRecherche::rechercheDeJointure($champ[0], $url_page_depart, $module, $table_champ_retour, $table_tous_champs_rech);
     // Recuperation de l'operateur
     $tmp = $operateur_recherche[$i][$j];
     $sql2 = " SELECT valeur_intranet_moteur_de_recherche_operateur_sur_champ\n                              FROM intranet_moteur_de_recherche_operateur_sur_champ\n                              WHERE  id_intranet_moteur_de_recherche_operateur_sur_champ=' {$tmp}'";
     //$res2= DatabaseOperation::query( $sql2)or die('Erreur SQL !'.$sql2.'<br>'.mysql_error()) ;
     $res2 = DatabaseOperation::convertSqlStatementKeyAndOneFieldToArray($sql2);
     //operateur
     foreach ($res2 as $operateur) {
         $table_et_champ = $champ[1] . '.' . $champ[0];
         switch ($operateur_recherche[$i][$j]) {
             case 1:
                 $where .= $table_et_champ . '  LIKE ( \'%' . $texte_recherche[$i][$j] . '%\' ) ';
                 break;
             case 2:
                 $where .= $table_et_champ . ' NOT LIKE ( \'%' . $texte_recherche[$i][$j] . '%\' ) ';
                 break;