Hi,

I have a table which has 3 columns (title, description, billrate).
It has many rows depend on values returned from database.
Now, I want to sort it based on title. Each title has its own description and billrate.
How do I do this?
Thanks.

Mike

    Mike, have you seen the PHP array sort functions?

    php.net/asort
    php.net/arsort
    php.net/ksort

    and so forth... plus there's a great functions in the comments of each of those pages to do multi-dimensional array sorts if you need that (which it doesnt' sound like you do).

      Hi Eric,

      I solved the array!
      I'm using the ksort (by key).
      Here's what I did:
      <?
      ...
      // in the for loop for variables every row
      $rowsort[$title] = "$desc*$billrate";

      ...
      // outside the loop
      ksort($rowsort);
      while(list($key,$val) = each ($rowsort))
      {
      $title = $key;
      $getvar = explode("*", $val);
      $desc = $getvar[0];
      $billrate = $getvar[1];
      ... // rest of the codes
      }

      ?>

      Thanks for the reference.

      Mike

        no prob, glad it worked for ya! best, Eric

          Write a Reply...