Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting the search relevant results from mysql in PHP

Status
Not open for further replies.

dreamaz

Technical User
Dec 18, 2002
184
CA
Hi,

I have a simple search function to search for articles in MYSQL and return the results. I currently have the score displayed in decimals and would like it in percentage, please help.

//select statement
SELECT *,
MATCH (Problem, ArticleTitle, Cause, Symptom)
AGAINST ('$searchstring') AS score FROM KB_TEST
WHERE MATCH (Problem, ArticleTitle, Cause, Symptom)
AGAINST ('$searchstring') ORDER BY score DESC

//show results

<?php
echo ' '.stripslashes(htmlspecialchars($row->ArticleTitle));
echo '<br>'.stripslashes(htmlspecialchars($row->Cause));
echo '<br>'.number_format($row->score, 1);
?>

My results are currently like 1.7, 1.9, 2.0 0.8 etc..

Any help is appreciated.

Thanks,

dr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top