My Dear Php Buddies,
Consider a mysql tbl index.tbl that looks like this with entries:
id | Url | Description
0|
1|
2|
3|
Now, imagine you did a search for “register domain names”.
Now, I want the query to rank the rows based on the most matched keywords. So, from our example, the ranking should be like this:
0|
1|
3|
2|
Note that, the id=0 has 3 KWs matches. Hence on top.
Both the id=1 & id=3 have 2 matches. Hence 2nd & 3rd. Amongst these 2, priority of rank is given based on “id” (link submission id).
And ofcourse, the last matched row is at the bottom.
Q1a. How would you write the Sql query be doing the querying & ranking like I described ?
Q1b. Is just the Sql querying enough here to do the ranking display like described or have to get php to do the ranking display aswell ? Or, maybe Sql should not be doing the ranking display atall but php ? In that case, my I see a php sample code ?
This no good which I got so far:
$query = “SELECT * FROM notices WHERE description = register AND Domain AND Names”;