dbx_sort
(PHP 4 >= 4.0.6, PHP 5 <= 5.0.5, PECL dbx:1.1.0)
dbx_sort — Sortiert das Ergebnis einer dbx-Abfrage mittels einer Benutzerfunktion
Beschreibung
      bool dbx_sort
       ( object $result
      , string $user_compare_function
      )
    Gibt bei Erfolg TRUE zurück, im Fehlerfall FALSE.
Hinweis: Wenn möglich ist es besser, die ORDER BY SQL Klausel anstatt von dbx_sort() zu verwenden.
Example#1 dbx_sort()
<?php
function user_re_order ($a, $b) {
    $rv = dbx_compare ($a, $b, "parentid", DBX_CMP_DESC);
    if ( !$rv ) {
        $rv = dbx_compare ($a, $b, "id", DBX_CMP_NUMBER);
    }
    return $rv;
}
$link   = dbx_connect (DBX_ODBC, "", "db", "username", "password")
    or die ("Fehler beim Verbinden");
$result = dbx_query ($link, "SELECT id, parentid, description FROM tbl ORDER BY id");
    // Die Daten in $result sind nun nach id geordnet
dbx_sort ($result, "user_re_order");
    // Die Daten in $result sind nun nach parentid (absteigend) geordnet,
    // dann nach id
dbx_close ($link);
?>
Siehe auch dbx_compare().