title: I need to search with multi variable and sort
body: <p>I can search multiple value with mysql.
  I need to implement SORT BY on it </p>
  
  <p>This is my coding which is working perfect </p>
  
  <pre><code>   $conditions = array();
  if ($key) {
    $conditions[] = 'job_title LIKE "%'.$key.'%"';
  }
  if ($category) {
    $conditions[] = 'job_category = "'.$category.'"';
  }
  if ($location) {
    $conditions[] = 'job_location = "'.$location.'"';
  }
  if ($country) {
    $conditions[] = 'job_country = "'.$country.'"';
  }
  if ($salary) {
    $conditions[] = 'job_salary &gt;= "'.$salary.'"';
  }
  
  
  $sqlStatement = 'SELECT * FROM jobs JOIN job_category ON  jobs.job_category=job_category.category_id  '.implode(' AND ', $conditions);
  </code></pre>
  
  <p>When I apply SORT BY
  like this </p>
  
  <pre><code>if ($sort) 
  {
  $conditions[] = 'ORDER BY "'.$sort.'"';
  $sqlStatement = 'SELECT * FROM jobs JOIN job_category ON  jobs.job_category=job_category.category_id  '.implode(' AND ', $conditions);
  }
  else
  {
  $sqlStatement = 'SELECT * FROM jobs JOIN job_category ON  jobs.job_category=job_category.category_id  '.implode(' AND ', $conditions);
  }
  </code></pre>
  
  <p>result is </p>
  
  <blockquote>
    <p>Blockquote
    SELECT * FROM jobs JOIN job_category ON jobs.job_category=job_category.category_id job_location = "Manjeri" AND ORDER BY "job_salary"
    Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /Applications/XAMPP/xamppfiles/htdocs/work/mobjob/test.php on line 41</p>
  </blockquote>