select function

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

 



Hi,

 

I can't remember if this is the PHP list for RPG programmers or not, so
apologize if this is the wrong one.

 

Is there an equivalent command in PHP for the SELECT statement in RPG? I see
switch, which is a little similar, but far from how it actually functions.

 

For those not familiar with the SELECT statement here is how I envision it
working in a PHP format similar to switch:

 

SELECT {

                WHEN $Auth = 0:

                WHEN $A = 1:

                                echo('$Aprint_list');

                WHEN $B = 1:

                                echo('$Bprint_list');

                WHEN $A = 2:

                                echo('$Aprint_list');

                                echo('$Aprint_list');

                WHEN $B = 2:

                                echo('$Bprint_list');

                                echo('$Bprint_list');

                DEFAULT:

}

 

The syntax may be a little off, but you get the picture. No breaks are
needed because it only performs the first match it comes to, then exits the
SELECT statement when finished the commands under that match. Putting a WHEN
statement with nothing to perform means exactly that, if this matches, do
nothing, then exit the SELECT statement. I hope that makes sense. The big
difference is you can put anything behind each WHEN statement as opposed to
looking at only the one variable like with switch. I am thinking I just need
to get creative with the switch or elseif commands, but thought I would ask
the list first if they had any better suggestions.

 

 

Thanks,

 

Jeff Burcher - IT Dept

Allred Metal Stamping

PO Box 2566

High Point, NC 27261

(336)886-5221 x229

jeff@xxxxxxxxxxxxxxx

 


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux