title: PHP not retrieving new data until page refresh
body: <p>What is happening is I think my code is selecting the data first (basically old data) then updating it but what I want is for it to update then select the data (new data). How can I do this?</p>
  
  <p>I am going to post where it goes wrong and if you need the full code just ask:</p>
  
  <pre><code>        $select_links = $db-&gt;query("SELECT pid, added_by,link_title,lid,link_order FROM " . TABLE_PREFIX . "homepage_links WHERE pid='$pid' 
           ORDER BY link_order DESC LIMIT $start,$show");
      $check_link_count_rows = $db-&gt;num_rows($select_links);
      echo "&lt;b&gt; You Current Have " . $check_link_count_rows . " Links On Your Page: &lt;/b&gt;&lt;br&gt;";
      echo "&lt;form action='' method='POST'&gt;
  ";
      while($select_links_array = $db-&gt;fetch_array($select_links)) {
      $link_title_display = $select_links_array['link_title'];
      $link_id_display = $select_links_array['lid'];
      if(!$mybb-&gt;input["order_edit_$link_id_display"]) {
      $link_order_display = $select_links_array['link_order'];
      } else {
      $link_order_display = $mybb-&gt;input["order_edit_$link_id_display"];
      }
  
  
  
      $order_edit_value1 = $mybb-&gt;input["order_edit_$link_id_display"];
      $order_edit_value = $db-&gt;escape_string($order_edit_value1);
  
  
      echo "&lt;br&gt;" . $link_title_display . " &lt;a href='?operation=edit_links&amp;link=$link_id_display'&gt; (edit) &lt;/a&gt;
  
      &lt;input type='number' name='order_edit_$link_id_display' value='$link_order_display' style='width:40px;'&gt;
      &lt;input type='hidden' name='get_link_id_display_value_$link_id_display' value='$link_id_display'&gt;&lt;br&gt;
  
      ";
  
  
  
  $get_link_id_display_value1 =  $mybb-&gt;input["get_link_id_display_value_$link_id_display"];
  $get_link_id_display_value = $db-&gt;escape_string($get_link_id_display_value1);
      $update_quick_edit_query = $db-&gt;query("UPDATE spud_homepage_links SET link_order='$order_edit_value'
  WHERE lid='$get_link_id_display_value'");
      }
  </code></pre>
  
  <p>I cannot find a solution as everything is in the right place for it to work besides this bug.</p>