PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

ODBC> <dbx Funktionen
Last updated: Fri, 05 Sep 2008

view this page in

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.

Beispiel #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().



add a note add a note User Contributed Notes
dbx_sort
There are no user contributed notes for this page.

ODBC> <dbx Funktionen
Last updated: Fri, 05 Sep 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites