Make this more simple/faster
<p>Is there a way to make this query faster:</p>

<pre><code>$qur = mysql_query("
 SELECT id, firstname, lastname, 
 (firstname = '$firstname' AND lastname = '$lastname') AS full FROM users 
 WHERE (firstname = '$firstname' AND lastname='$lastname') 
 OR (firstname LIKE '$firstname%' AND lastname LIKE '$lastname%')
 OR firstname LIKE '$firstname%' OR lastname LIKE '$firstname%'
 ORDER BY (firstname = '$firstname' AND lastname='$lastname') DESC");
</code></pre>

<p>What I need in this:</p>

<pre><code>Check if its a full match.
Get firstname lastname
Being able to only enter lastname "Fox" and let it find the firstname (get all users with lastname Fox, and show their firstname too and display check the script at bottom.)
Being able to only enter the firstname "Megan" and let it find the lastname (^)
Being able to only enter Megan F, and let it show "Megan Fox"
Being able to only enter Me Fox, and let it show "Megan Fox"
</code></pre>

<p>This is what it does to me, working without no problem. Although maybe I think this would run slow when alot of users run it</p>

<p>I'm using it with this:</p>

<pre><code> if (mysql_num_rows($qur) == 1) {

 $get = mysql_fetch_array($qur);
    if($get["full"] == 1){
    echo $get["id"];
    }else{
     echo "Did you mean: ".$get["firstname"]." ".$get["lastname"]." ?";
    }
 }elseif(mysql_num_rows($qur) &gt; 1){
    while($get = mysql_fetch_array($qur)) {
       $name[] = $get["firstname"]." ".$get["lastname"];
   }

   if(count($name) &gt; 1) {
       echo 'Who did you mean?&lt;br&gt;';
   } else {
       echo 'Did you mean: ';
   }
   echo implode('&lt;br&gt;', $name);

 } 
</code></pre>
