Thanks for the thought Alex,
alas, unlike other languages, PHP handles ANY scalar value in a switch
statement, including variables....

So now I an really stumped !!

I am gonna try a whole series of 'ifs' though and deal with the ugliness
of it !

thanks again for your post,

regards

richard

--- Alec Smith <[EMAIL PROTECTED]> wrote:
> One thing -- If I'm not mistaken, you can only use a
> switch/case/break/case/etc construct for types that resolve to an
> integer
> type -- either an int or a char. To do comparisons based on strings, I
> think you'll need strcmp() and a whole lot of if/else if blocks.
> 
> 
> 
> On Wed, 14 Nov 2001, richard phynga wrote:
> 
> > Hello people out there,
> >
> > I have been tearing my hair out with this one, as I cannot get
> imap_sort
> > to perform correctly.
> >
> > below is the piece of code that I use. of all the sort types, only
> > SORTSIZE works. All the otheres give incorreclty sorted lists.
> >
> > to see an example of this please go to :
> >
> > http://www.tijuana.com
> >
> > login : phplist
> > passwd : phplistphp
> >
> > and send the account an email. Click on the header columns to sort the
> > headers.
> >
> > please tell me what I am doing wrong..... I cant stare at it any
> longer :(
> > _______________________________________
> > machine OS specs:
> > RH7.1, php4.0.5, wu-imap, apache1.3.19
> > ---------------------------------------
> > <---code snip ----------->
> >
> > $newstrm = imap_open ($ms.$selectedmb, $usr, $usrpwd) or die ("cant
> > connect: ".imap_last_error());
> >   switch ($sortby) {
> >     case "date":
> >   $sorted_headers = imap_sort($newstrm,SORTDATE, $rev_flag,'');
> >       break;
> >     case "subject":
> >   $sorted_headers = imap_sort($newstrm,SORTSUBJECT, $rev_flag,'');
> >       break;
> >     case "tag":
> >       if ($tag == "From") {
> >   $sorted_headers = imap_sort($newstrm,SORTFROM, $rev_flag,'');
> >       } else {
> >   $sorted_headers = imap_sort($newstrm,SORTTO, $rev_flag,'');
> >       }
> >       break;
> >     case "size":
> >   $sorted_headers = imap_sort($newstrm,SORTSIZE, $rev_flag,'');
> >       break;
> >   }
> >   while (list(,$qq) = each($sorted_headers)) {
> >     $header = imap_headerinfo($newstrm, $qq);
> >     $msgnumber = $header->Msgno;
> >
> > etc etc etc..
> >
> > <--- code snip ------------->
> >
> > but hte order never come out correct. The listing of using the sort by
> > does change, but it is not correct.
> >
> > thanks in advance
> >
> > richard
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Find the one for you at Yahoo! Personals
> > http://personals.yahoo.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail:
> [EMAIL PROTECTED]
> >
> >
> 


__________________________________________________
Do You Yahoo!?
Find the one for you at Yahoo! Personals
http://personals.yahoo.com

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to