title: Convert if else to try catch
body: <p>Can somebody help me in converting the following code written using if-else to try/catch. Also let me know is trycatch needed in this case or if-else is apt</p>
  
  <pre><code>$results = mysql_query($query);
  if(mysql_num_rows($results)!=0)
  {
      while(($result = mysql_fetch_row($results))!=FALSE)
      {
          $res   ="DELETE FROM table1 WHERE id ='".$result['id']."'";
          if(mysql_query($res)==false)
          {
              echo mysql_error();
              exit;
          }
      }
      echo $res   ="DELETE FROM table2 WHERE id ='".$id."'";
      if(mysql_query($res)!==false)
      {
          header("Location:list.php?m=4");
      }
      else
      {
          echo mysql_error();
          exit;
      }
  }
  else
  {
      echo "Error";
  }
  </code></pre>