Imagine a database table with the fields URL, PX, IVR, ER, FW, JB and SM. URL contains people's names. Each cell in each of the other fields can contain one of two values - the name of the field or NULL:
There's one more key to the puzzle: The script I want to write will vary depending on the local website. For example, let's say we're visiting http://www.SM.com, identified by $MySiteID = 'SM'.Code:URL | PX | IVR | ER | FW | JB | SM (1) Joe_White | NULL | NULL | NULL | NULL | NULL | SM (2) Cat_Smith | PX | IVR | ER | FW | JB | SM (3) Dan_White | PX | NULL | NULL | NULL | NULL | NULL (4) Joe_Cool | NULL | IVR | NULL | NULL | NULL | NULL (5) Tom_Brown | NULL | NULL | ER | FW | NULL | NULL
Now suppose you have a query, followed by the following echo statements:
$PX (equals the contents of the cell on field PX that correlates with the name in Field URL)
$IVR (displays the contents of the cell on field IVR that correlates with the URL)
$ER, $FW, $JB & $SM follow the same pattern.
Can someone show me how to write a switch(es) or IF statement(s) that does the following?:
Thanks.Code:1. Display "SM" if the field SM contains the value SM (rows 1 and 2 in the example above) 2. If SM is NULL, and there's just one entry in another field, display that value (e.g. "PX" in the third row in the above example or "IVR" in the next row. 3. If there are values in two or more fields, none of which equal $MySiteID ( SM, in this example), display "Multiple Choice" (the last row in the example above).








Bookmarks