Title: ech3's Replies | WordPress.org

---

# ech3

  [  ](https://wordpress.org/support/users/ech3/)

 *   [Profile](https://wordpress.org/support/users/ech3/)
 *   [Topics Started](https://wordpress.org/support/users/ech3/topics/)
 *   [Replies Created](https://wordpress.org/support/users/ech3/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/ech3/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/ech3/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/ech3/engagements/)
 *   [Favorites](https://wordpress.org/support/users/ech3/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[SQLite Integration] SQLite: unexpected T_FUNCTION](https://wordpress.org/support/topic/sqlite-unexpected-t_function/)
 *  Thread Starter [ech3](https://wordpress.org/support/users/ech3/)
 * (@ech3)
 * [11 years, 11 months ago](https://wordpress.org/support/topic/sqlite-unexpected-t_function/#post-5279163)
 * I ended up having to add a dollar sign before the orderby_callback function’s
   flipped variable in a couple of places to get it to work. Below is the diff I
   used.
 * [Edit – Reversed the diff to the correct direction]
 *     ```
       --- query.class.php.orig        2014-09-12 06:21:17.802511000 -0400
       +++ query.class.php     2014-09-12 06:11:27.503756000 -0400
       @@ -766,15 +766,20 @@
                                       $_wpdb = new PDODB();
                                       $results = $_wpdb->get_results($query);
                                       $_wpdb = null;
       -                               $compare = function($a, $b) {
       -                                       global $flipped;
       -                                       return $flipped[$a->ID] - $flipped[$b->ID];
       -                               };
       -                               usort($results, $compare);
       +                               //$compare = function($a, $b) {
       +                                //global $flipped;
       +                                //return $flipped[$a->ID] - $flipped[$b->ID];
       +                               //};
       +                               //usort($results, $compare);
       +                                usort($results, array($this, 'orderby_callback'));
                               }
                               $wpdb->dbh->pre_ordered_results = $results;
                       }
               }
       +       private function orderby_callback($a, $b) {
       +               global $flipped;
       +               return $flipped[$a->ID] - $flipped[$b->ID];
       +       }
               /**
                * Method to avoid DELETE with JOIN statement.
                *
       ```
   

Viewing 1 replies (of 1 total)