Posted by Mike
2014-06-03

correction for previous comment.

instead:
When echo $rs['ad_type'] ,I get: S1001

should be:
When echo $rs['color'] ,I get: S1001

sorry...
Posted by Tom
2014-06-03

You can use this function to get the corresponding value of a particular key.
define( 'SEL_AD_COLOR', "
S1001=Blue
S1002=Green
S1003=Yellow
" );

function getColorVal( $key ) {
if ( preg_match( '/\n'.$key.'=(.+)\r?\n/', SEL_AD_COLOR, $mx ) ) {
return $mx[1];
} else {
return '';
}
}

This is code to test the function.
echo getColorVal( 'S1002' ); // displays 'Green'