Aller au contenu

dimko

Membre
  • Compteur de contenus

    1
  • Inscrit(e) le

  • Dernière visite

Réputation sur la communauté

0 Neutre
  1. Hi to all. Sorry that this is in english, but I have even no idea how I found this forum and succeed to register Hope you'll have no problem with my english. So, this it the case: I have this code: $recherche = $searchsql; $mots = explode(' ', $recherche); //separation des mots de la recherche a chaque espace $nombre_mots = count ($mots); //compte le nombre de mots $valeur_requete = ''; for($nombre_mots_boucle = 0; $nombre_mots_boucle < $nombre_mots; $nombre_mots_boucle++) //tant que le nombre de mots de la recherche est superieur a celui de la boucle, on continue en augmentant la variable $nombre_mots_boucle de 1 a chaque fois { $valeur_requete .= 'AND a.adtitle RLIKE \'[[:<:]]' . $mots[$nombre_mots_boucle] . '[[:>:]]\''; //modification de la variable $valeur_requete $valeur_requete2 .= 'AND a.addesc RLIKE \'[[:<:]]' . $mots[$nombre_mots_boucle] . '[[:>:]]\''; //modification de la variable $valeur_requete } $valeur_requete = ltrim($valeur_requete,'AND'); //suppression de AND au debut de la boucle $valeur_requete2 = ltrim($valeur_requete2,'AND'); //suppression de AND au debut de la boucle $whereA[] = "(" . $valeur_requete . " OR " . $valeur_requete2 . ")"; So, what I want to do, is to merge a.adtitle and a.addesc and the code should look something like this: $recherche = $searchsql; $mots = explode(' ', $recherche); //separation des mots de la recherche a chaque espace $nombre_mots = count ($mots); //compte le nombre de mots $valeur_requete = ''; for($nombre_mots_boucle = 0; $nombre_mots_boucle < $nombre_mots; $nombre_mots_boucle++) //tant que le nombre de mots de la recherche est superieur a celui de la boucle, on continue en augmentant la variable $nombre_mots_boucle de 1 a chaque fois { $valeur_requete .= 'AND a.merged RLIKE \'[[:<:]]' . $mots[$nombre_mots_boucle] . '[[:>:]]\''; //modification de la variable $valeur_requete } $valeur_requete = ltrim($valeur_requete,'AND'); //suppression de AND au debut de la boucle $whereA[] = "(" . $valeur_requete . ")"; So, my point is that the search doesn't check first the Ad Title, and then the Ad Description, one by one, and sees them like a separate text, but I want to merge them, so the search should sees them as one whole text, which will contain the text from the Ad Title and the text from the Ad Description, as a whole. I'm trying to make the search function to search through Ad Title and Ad Descriptin at the same time, like it's one text, not separately like it's doing it with the first code. So, if anyone know how to make this, please post the solution here. P.S. I found the code googleing it on some other forum, and it works perfectly, exept the thing I asked for. So, tnx in advance, and sorry again for my english and if I post this in a wrong section.
×
×
  • Créer...