Statut : Non résolu[php/mysql] difficulté sur mon moteur de recherche
Posté par
snap, le lundi 18 juillet 2005 à 16:55:06 Bonjour
Je doit faire un moteur de recherche (rechercche dans la base de donnée) mais là je bloque
Quelqu'un peut'il m'aider SVP car debutant que je suis , là je patoge ......
j'ai sa comme ereur;
Warning: mysql_result(): supplied argument is not a
valid MySQL result resource in
/web/testweb/recherche.php3 on line 132
Warning: mysql_num_rows(): supplied argument is not a
valid MySQL result resource in
/web/testweb/recherche.php3 on line 135
J'ai tester m'a requete sur phpadmin:
et j'ai ça comme erreur;
#1191 - Can't find FULLTEXT index matching the column
list
Voici mon code
***********DEBUT DU CODE*******
$db_link = mysql_connect;
("$sql_serveur","$sql_user","$sql_passwd");
$fonction=$_GET[' fonction']; // pri a partir d'un menu deroulant
$niveau=$_GET['niveau']; // pri a partir d'un menu deroulant
$mot=$_GET['mot']; // pri à partir champ de type text
$mot=strtolower($mot);
$mots=split(" ",$mot);
$nombre_mots=count($mots);
$z=1;
$texte="Pages contenant <b>"$mots[0]"</b>";
$phrase="'%$mots[0]%'";
while($z<$nombre_mots)
{
$phrase.=" ".$et_ou." mots like '%$mots[$z]%'";
$texte.=" ";
if($et_ou=="and"){$texte.="et";}else{$texte.="ou";}
$texte.=" <b>"$mots[$z]"</b>";
$z++;
}
if($debut==""){$debut=0;}
$debut=$p age*$limit;
// NOMBRE TOTAL D'ENREGISTREMENTS REPONDANT A LA REQUETE
$requete=mysql_db_query("$sql_bdd","select count(*) from cv WHERE MATCH ( ref ,titre, nom, code,ville, fonction, region1, nom_entr1,prec_ent, nom_entr2 ) AGAINST ('$phrase') AND (fonction LIKE '$fonction') AND (niveau LIKE '$niveau')",$db_link);
$nb_total=mysql_result($requete,0,"count(*)");
$reque te=mysql_db_query("$sql_bdd","select * from cv WHERE MATCH ( ref ,titre , nom ,code, ville, fonction, region1, nom_entr1, prec_ent, nom_entr2) AGAINST ('$phrase') AND (fonction LIKE '$fonction') AND (niveau LIKE '$niveau') limit $debut,$limit",$db_link);
$num=mysql_num_rows($requete); // ------- ICI LIGNE 135
// DEFINITION DU MESSAGE A AFFICHER
if ($num==0) {echo "Désolé, aucune page de ce site ne contient
<b>$mot</b>...";}
else if ($mot=="") {echo "Veuillez saisir mot-clés avant de cliquer
sur 'lancer la recherche' !";}
else if (strlen($mot)<2) {echo "Veuillez saisir au moins 2
caractères.";}
// AFFICHAGE DES RESULTATS
else {
echo "<span class="style2"><b>$nb_total</b> réponse</span>";
if ($nb_total>1) {echo "s";}
//echo "<br>$texte";
//$i=0;
while ($tablo = mysql_fetch_object($requete)) {
print "<TR>";
print "<TD><BR></TD>";
print "</TR>";
print "<TR bgcolor="#E0ECF8">";
print "<TD nowrap class="style2" bgcolor="#E0ECF8" ><b>Candidature
à l'offre: </b>$tablo->ref</TD>";
print "<TD>";
print "<TD nowrap class="style2" bgcolor="#E0ECF8"><b>Region
souhaité</b></TD>";
*********************
*** *************
*****************
****************
}
?>
</table> </td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
</h tml>
<?
print"<center>";
// AFFICHAGE DU LIEN PRECEDENT SI BESOIN EST
// (LA PREMIERE PAGES EST 0)
if ($page>0)
{
$precedent=$page-1;
print "<a
href="$script_name?page=$precedent&mot=$mot&fonction=$fonction&niveau=$niv eau">PRECEDENT</a> n";
}
// AFFICHAGE DES NUMEROS DE PAGE
$i=0;$j=1;
if($nb_total>$limit)
{
while($i<($nb_total/$limit))
{
if($ i!=$page){echo "(<a
href="$script_name?page=$i&mot=$mot&fonction=$fonction&niveau=$niveau">$ j</a>) ";}
else {echo "<b>($j)</b> ";}
$i++;$j++;
}
}
// AFFICHAGE DU LIEN SUIVANT SI BESOIN EST
if($debut+$limit<$nb_total)
{
$suivant=$page+1;
echo "<a
href="$script_name?page=$suivant&mot=$mot&fonction=$fonction&niveau=$nivea u">SUIVANT</a>";
}
}
print"</center>";
// DECONNEXION DE LA BASE DE DONNEE
mysql_close($db_link);
?>
Voici comment est constitué ma table parti fulltext
CREATE TABLE `cv` (
***********
*********
***
**
**
PRIMARY KEY (`id`),
KEY `type_mobil` (`mobil_reg`),
FULLTEXT KEY `titre` (`ref`,`titre`,`nom`,`code`,`ville`,`fonction`,`region1`,`nom_entr1`,`prec_ent`, `nom_entr2`)
) TYPE=MyISAM PACK_KEYS=0 AUTO_INCREMENT=50 ;
Quequ'un peut t'il m'aider s'il vous plait, une remarque , une idée, n'importe quoi qui puisse que j'avance car je bloque depuis hier.
Merci car mon stage ce fini bientot et je dois trouvé une solution .
MERCI POUR VOTRE COMPREHENSION.