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
|
//fonction pour calculer le nombre de mots rentrés dans l'input
function nbmots($MaChaine,$xmots)
{
$ChaineTab=explode(" ",$MaChaine);
for($i=0;$i<$xmots;$i++)
{
$NouvelleChaine.=" "."$ChaineTab[$i]";
$NouvelleChaine = trim($NouvelleChaine);
}
return $NouvelleChaine;
}
echo nbmots($nb_mots_saisis,2) ;
//à partir de là, c'est l'incertitude, je sais pas trop comment faire
while ($nb_mots_saisis < 2)
{
if (strlen($p_search[nb_mots_saisis])>2) {
$valeur_req2 .= " +$p_search[nb_mots_saisis]*";
}
}
if (!empty($_REQUEST['search2']) && $_REQUEST['notsearch2']=="oui") {
$search2=$_REQUEST['search2'];
$p_search2=addslashes($search2);
$notsearch2=$_REQUEST['notsearch2'];
$valeur_req2 .= " -$p_search2";
}
//$valeur_req2 .= "'";
$sqlcount2 = "select count(id) from table WHERE MATCH (champ_texte) AGAINST ('$valeur_req2' IN BOOLEAN MODE)";
$resultcount2 = mysql_query($sqlcount2,$conn) or die('Erreur SQL !'.$sqlcount2.'<br>'.mysql_error());
$rangcount2 = mysql_fetch_row($resultcount2);
$total_produits = $rangcount2[0];
mysql_free_result($resultcount2); |
Partager