title: php update query and order
body: <p>please i am having issues concerning the order of records after updating.
  I have two pages <code>home.php</code> and <code>settings.php</code>.
   The <code>home.php</code> contains result from a mysli select query.</p>
  
  <pre><code>$getid = $getdata['user_id'];
  $query = mysqli_query($con,"SELECT * FROM  posts 
                              WHERE `user_id` = ' $get_id' 
                              ORDER BY date_added DESC 
                              LIMIT 15 ");
  </code></pre>
  
  <p>The records being selected are <code>id</code> <code>username</code> <code>notes</code> <code>date_added</code>, these records are successfully displayed in  <code>desc</code> order.</p>
  
  <p>On my <code>settings.php</code> i'm allowing the user to update their username,while updating their username,i also run a update query that change the username on the <code>notes</code> table. New username are successfully updated both on the <code>user</code> table and <code>notes</code> table. But the unfortunate things is,when i get back to the <code>home.php</code> , the notes are not displayed in <code>desc</code> order again. it is displaying the notes from the top of the table.</p>
  
  <p>The update query function(called from the <code>settings.php</code>):</p>
  
  <pre><code>function update_user($update_data){
      $con = db();
      global $session_user_id;
      $update= array();
      array_walk($update_data, 'array_sanitize');
      foreach ($update_data as $field =&gt; $data) {
          $update[] = '`'. $field . '` =\''.$data .'\'';
      }
      mysqli_query($con,"UPDATE `users` SET " 
                         . implode(', ', $update) . , 
                        " WHERE `user_id` = '$session_user_id'");
  
      mysqli_query($con,"UPDATE notes SET username = 
                                  (SELECT `username`
                                  FROM  users 
                                  WHERE user_id = $session_user_id
                                  ) 
                          WHERE user_id = $session_user_id ");
  }
  </code></pre>
  
  <p>I have tried ordering by <code>date_added</code>, it's not working still.
  Kindly help me out, thanks.</p>