i want to make sql search
for now i am using this
$term="red sky";
$query=explode(' ', $term);
$sql = "SELECT * as result FROM `disk` WHERE ";
$a=0;
foreach ($query as $part)
{
$part=mysqli_real_escape_string($con, $part);
$a++;
if ($a==1)
{
$sql .= " title like '%".$part."%'";
}
else
{
$sql .= " and title like '%".$part."%'";
}
}
$sql = $sql." order by time desc";
$i=0;
if ($term!="")
{
$result = mysqli_query($con, $sql);
$row = mysqli_fetch_array($result);
}
so this results in showing results like:
- vredy tskyi
- redy sky
- vredy sky
- red sky
i want to order it somehow so it show "red sky" at first and other results are same so they can arrange themselves.
second thing--- this type of searching is a bit slow, i want to make it faster. please help me by making a new faster script or update in this one. (must work same but faster)
for more details plz comment. its hard to explain