How to display results in order of the number of matched keywords?

Thanks to the fantastic youtube video you can get here if you want, I managed to create a php search engine. Below is the code:

<?php


//connected to DB

      foreach (array('questioncontent') as $varname) {
        $questioncontent = (isset($_GET[$varname])) ? $_GET[$varname] : '';
      }

?>

<form action="previousquestions.php" method="get">
      <p>Search: <input type="text" name="questioncontent" value="<?php echo $questioncontent; ?>" /></p>
      <p><input id="searchquestion" name="searchQuestion" type="submit" value="Search" /></p>
      </form>

<?php 

if (isset($_GET['searchQuestion'])) {

$searchquestion = $questioncontent;
$terms = explode(" ", $searchquestion);

              $questionquery = "SELECT * FROM Question WHERE ";

              foreach ($terms as $each){
               $i++;   

               if ($i == 1){
               $questionquery .= "QuestionContent LIKE '%$each%' ";
          } else{
               $questionquery .= "OR QuestionContent LIKE '%$each%' ";

              }

          }

      $questionnum = mysql_num_rows($questionresult = mysql_query($questionquery));

        else if($questionnum !=0){

      $output = "";
$output .= "
    <table border='1'>
      <tr>
      <th>Question</th>
      </tr>
";
        while ($questionrow = mysql_fetch_array($questionresult)) {
$output .= "
      <tr>
      <td>{$questionrow['QuestionContent']}</td>
      </tr>";
        }
        $output .= "        </table>";

        echo $output;

  }

}

  mysql_close();

?>

Now I have a question about how, if possible, you can organize the search results. Let's say in the database I have these 3 entries:

My name
My name is Mayur Patel
My name is Patel

, "name Mayur Patel", , , , , , , , ( ), :

My name is Mayur Patel (all keywords match in this phrase)
My name is Patel (2 keywords match this phrase which are 'name' and 'Patel')
My name (1 keyword match this phrase which is 'name')

, , , ?

+3
1

, , :

SELECT * FROM Question WHERE
QuestionContent LIKE '%name%'
OR QuestionContent LIKE '%Mayur%'
OR QuestionContent LIKE '%Patel%'

, , , , :

ORDER BY
IF(QuestionContent LIKE '%name%',1,0)+
IF(QuestionContent LIKE '%Mayur%',1,0)+
IF(QuestionContent LIKE '%Patel%',1,0) DESC

, , , , , , 0. , 3, 2, 1 DESC, .

: http://www.sqlfiddle.com/#!2/eaabc/2


: , PHP-:

$questionquery = "SELECT * FROM Question WHERE ";
foreach ($terms as $each) {
    $i++;   

    if ($i == 1){
        $questionquery .= "QuestionContent LIKE '%$each%' ";
    } else {
        $questionquery .= "OR QuestionContent LIKE '%$each%' ";
    }
}

$questionquery .= " ORDER BY ";
$i = 0;
foreach ($terms as $each) {
    $i++;

    if ($i != 1)
        $questionquery .= "+";
    $questionquery .= "IF(QuestionContent LIKE '%$each%',1,0)";
}
$questionquery .= " DESC";
+6