Array sortieren!

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Array sortieren!

    Hallo Zusammen,

    habe mal wieder ein Prolem.
    Weis einer wie ic hdieses Array zu sortieren habe, damit ich REFERENCE_TIME aufsteigend sortiert bekomme?

    Mit

    PHP-Code:
    array_multisort($log_output[REFERENCE_TIME], SORT_NUMERICSORT_ASC); 
    klappt es nicht!

    PHP-Code:
    $xml = new XMLParser();
         
    40
         41    
    foreach ($lin as $line) {
         
    42       //echo " - $line";
         
    43       $xml->input($line);
         
    44    }
         
    45
         46    $erg 
    $xml->output();
         
    47
         48    $log_output 
    "<table border=\"1\">
         49           <th bgcolor=\"#0e599c\"><font color=\"#FFFFFF\">CALLTYPE</font></th><th bgcolor=\"#0e599c\"><font color=\"#FFFFFF\">DATE        </font></th>" 
    .
         
    50          "<th bgcolor=\"#0e599c\"><font color=\"#FFFFFF\">DURATION</font></th><th bgcolor=\"#0e599c\"><font color=\"#FFFFFF\">ERRO        R_CODE</font></th>" .
         
    51          "<th bgcolor=\"#0e599c\"><font color=\"#FFFFFF\">CALLING_NUMBER</font></th><th bgcolor=\"#0e599c\"><font color=\"#FFFFFF\        ">CALLED NUMBER</font></th>" .
         52          "
    <th bgcolor=\"#0e599c\"><font color=\"#FFFFFF\">CALLING_IMEI</font></th><th bgcolor=\"#0e599c\"><font color=\"#FFFFFF\">        CALLED_IMEI</font></th>" .
         
    53          "<th bgcolor=\"#0e599c\"><font color=\"#FFFFFF\">DIALLED_DIGITS</font></th><th bgcolor=\"#0e599c\"><font color=\"#FFFFFF\        ">CALL_REFERENCE</font></th>";
         54
         55    foreach (
    $erg as $value) {
         56       
    $log_output .= "<tr><td>{$value[CALLTYPE]}</td><td>{$value[REFERENCE_TIME]}</td>" .
         57             "
    <td>{$value[DURATION]}</td><td>{$value[ERROR_CODE]}</td>" .
         58             "
    <td>{$value[CONFORMED_CALLING_NUMBER]}</td><td>{$value[CONFORMED_CALLED_NUMBER]}</td>" .
         59             "
    <td>{$value[CALLING_IMEI]}</td><td>{$value[CALLED_IMEI]}</td>" .
         60             "
    <td>{$value[DIALLED_DIGITS]}</td><td>{$value[CALL_REFERENCE]}</td></tr>";
         61       }
         62    
    $log_output .= "</table>";
         63
         64 array_multisort(
    $log_output[REFERENCE_TIME], SORT_NUMERIC, SORT_ASC); 

    danke!
    Zuletzt geändert von petro_0; 05.08.2006, 15:29.
    gruss pedro

  • #2
    Re: Array sortieren!

    klappt es nicht!
    funzt net? - is ja komisch.
    danke!
    bitte

    ist $log_output ein array?

    Kommentar


    • #3
      mmmhhh schon! hehe!

      oder evtl. $erg.

      mit $log_output bekomme ich nichts raus...

      aber stimmt mein syntax denn?
      gruss pedro

      Kommentar


      • #4
        also $erg als array nimmt er auch nicht.
        Er sortiert einfach nicht.

        Wer weis wie ich das sortieren muss?

        Ich wil lden XML output in der tabelle nach Datum (referencetime) auf oder absteigend sortieren!

        Danke leute!
        gruss pedro

        Kommentar


        • #5
          Ich habe meine schwersten Zweifel, dass $log_output ein Array sein soll. Auch wenn es mal als Array initialisiert wurde, so überschreibst du es mit $log_output = wieder zu einem String...
          Weis einer wie ic hdieses Array zu sortieren habe, damit ich REFERENCE_TIME aufsteigend sortiert bekomme?
          Einfach sort() verwenden.
          Mach mal ein
          PHP-Code:
          var_dump($log_output); 
          und du wirst sehen, dass es kein Array ist
          Mach das auch mal für $erg, nur so um zu sehen ob das denn ein Array ist.
          Ach ja und ein
          PHP-Code:
          error_reporting(E_ALL); 
          am Anfang könnte auch weiterhelfen.

          Gruss

          tobi
          Gutes Tutorial | PHP Manual | MySql Manual | PHP FAQ | Apache | Suchfunktion für eigene Seiten

          [color=red]"An error does not become truth by reason of multiplied propagation, nor does truth become error because nobody sees it."[/color]
          Mohandas Karamchand Gandhi (Mahatma Gandhi) (Source)

          Kommentar


          • #6
            versuch ma usort()

            Kommentar

            Lädt...
            X