tulipputih 0 Junior Poster

Hi,
I am trying to apply ranking to the output of my search result based on the relevance of the searchterm & record in database.
when I run the below code..there was a query error

$searchterm=$db->escapeString($_GET['searchterm']);

$result = $db->query("SELECT subject, learningArea, ability, MATCH(subject, learningArea, ability) AGAINST('$searchterm') AS relevance FROM lesson IN BOOLEAN MODE)");

I have tried this as well

$result=$db->query("SELECT lessonID, subject, learningArea, ability FROM lesson WHERE MATCH (subject,learningArea,ability) 
AGAINST ('" . stripslashes (str_replace (""", "\"", ($_GET['searchterm']))) . "' IN BOOLEAN MODE) ");

the output was ok but no relevance shown..where should I put relevance here.

Many thanks for your help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.