title: Issues ascending and descending
body: <p>I am using ajax with php to sort and display my DB. However I can not switch between asc and desc. It only works for ASC, although I don't know why. $isAsc is staying at 1 no matter how many times I press the button. (I am using PHP 7.1)
  //AJAX</p>
  
  <pre><code>$('#sort_by_name').click(function(e){
      e.preventDefault();
      $.ajax({
          url: "data.php?order=&lt;?php echo isset($_GET['order'])?!$_GET['order']:1; ?&gt;",
          type: 'POST',
          asynch: false,
          data: {
              "sort_by_name":1
          },
          success: function(d){                
              $('#movie_container').html(d);
          }
      });
  });
  </code></pre>
  
  <p>//PHP</p>
  
  <pre><code>if (isset($_POST['sort_by_name'])) {
  $isAsc = isset($_GET['order']) ? (bool) $_GET['order'] : 1;
  if ($isAsc) {
      $sql = "SELECT id, movie_name, movie_year, movie_rating, movie_description, movie_imdb, movie_image, movie_my_rating FROM movies ORDER BY movie_name ASC";
      $result = $con-&gt;query($sql);
      if ($result-&gt;num_rows &gt; 0) {
          while ($row = $result-&gt;fetch_assoc()) {
              $rowcount = mysqli_num_rows($result);
              include 'show_movie_and_ribbon.php';
          }
      }
  } else {
      $sql = "SELECT id, movie_name, movie_year, movie_rating, movie_description, movie_imdb, movie_image, movie_my_rating FROM movies ORDER BY movie_name DESC";
      $result = $con-&gt;query($sql);
      if ($result-&gt;num_rows &gt; 0) {
          while ($row = $result-&gt;fetch_assoc()) {
              $rowcount = mysqli_num_rows($result);
              include 'show_movie_and_ribbon.php';
          }
      }
  }
  </code></pre>
  
  <p>}</p>