RE: while - if - problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> -----Original Message-----
> From: Earl [mailto:earl@caribsports.com]
> Sent: 04 June 2003 22:04
> To: PHP-DB
> 
> FYI
> this was beginning to bug me out... so I decided to try the 
> trim function....
> and walla... it worked.
> 
> Thanks for ya'll assistance.

I was going to say this even before you added the trim() calls in , but this
really does look like an excellent situation for using the switch construct
(just look at all those trim() calls and array accesses you save!):


while($cols=ifx_fetch_row($eventQuery)) 
{
  switch (trim($cols['out_type']))
  {
    case '0': 
      $r_away['linetype']='L';
      $r_home['linetype']='L';
      break;
  
    case '1':
      $r_away['linetype']='H';
      $r_home['linetype']='H';
      break;
  }
  
  switch (trim($cols["s_acro"]))
  {
    case 'CF':
    case 'PF': 
      $r_away['sport']='1';
      $r_home['sport']='1';
      $s_lt='PS';
      $t_lt='TP';
      break;

    case 'PB':
    case 'CB':
      $r_away['sport']='2';
      $r_home['sport']='2';
      $s_lt='PS';
      $t_lt='TP';
      break;

    case 'B':
      $r_away['sport']='3';
      $r_home['sport']='3';
      $s_lt='ML';
      $t_lt='TM';
      break;
   
    case 'H':
      $r_away['sport']='4';
      $r_home['sport']='4';
      $s_lt='ML';
      $t_lt='TM';
      break;
  }

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux