title: How can check empty url parameter in php
body: <p>I am working in php and phonegap.  i am sending title, category of song using url to php page. now i want  to select songs according to title and category if these both are provided in url. if url providing only title then search must be done according to title only. and if url providing category only then search must be basis on the category only.</p>
  
  <pre><code>**this is code which i am trying**
  
  $titletosearch = $_GET["title"];
  $categorytosearch = $_GET["category"];
  $artisttosearch = $_GET["artist"];
  if($titletosearch !=" " &amp;&amp; $titletosearch!=" ")
  $rs = mysql_query("SELECT title,price,date,category FROM music where title like '%$titletosearch%' or category like '%$categorytosearch%' ")  or die ("invalid query");
  elseif($titletosearch =="" &amp;&amp; $titletosearch!=" ")
  $rs = mysql_query("SELECT title,price,date,category FROM music where category like '%$categorytosearch%' ")  or die ("invalid query");
  elseif($titletosearch !=" " &amp;&amp; $titletosearch=="")
  $rs = mysql_query("SELECT title,price,date,category FROM music where title like '%$titletosearch%' ")  or die ("invalid query");
  </code></pre>
  
  <p>Problem with my code is this whenever i provide title only or category only in url then it searches so many records. means it work properly if i provide both title and category. if any of them  is not given then i provide so many results records.</p>
  
  <p>Please help how should i handle these conditions. ?</p>
  
  <p>Thank you in advance.</p>