Jump to content

search, sql order by priority of the searched term ?


yami007

Recommended Posts

i want to sort the available words by the "searched word"...is there any way ?

<?php

$query = "SELECT * FROM ce_cour_chap WHERE nom LIKE'%$find%' ORDER BY nom";
$result = mysql_query($query);

while($search = mysql_fetch_array( $result )) 
{ 
echo $search['nom']." - ".$search["chid"]."<br/>";
}
?>

Thanks for your time !

 

Let's assume a user typed "plan"

Regardless of the database's fields, I want to sort them by the word given "plan".

if "plan" is the first word of a sentence, it should go first even if another entry start with an a for example: "plan" should go first before "a plan"

 

- plan

- planning

- a plan

- the planning

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.