Bob Cabroni
New member
I have this part of code:
$model = $row['v_products_model'];
$smallid = substr($model, 0, 4);
What I need is to create a code to compare what the $smallid value is and associate this value with a name. Something like this:
If $smallid = '5456' then $mpg = 'Mouse'
If $smallid = '5434' then $mpg = 'Speakers'
If $smallid = '5432' then $mpg = 'Cable'
If $smallid = '5431' then$mpg = 'Adapters'
and etc, etc. I think a else if statement is not practical because the value of $smallid could be about 150 different values.
Please help.
$model = $row['v_products_model'];
$smallid = substr($model, 0, 4);
What I need is to create a code to compare what the $smallid value is and associate this value with a name. Something like this:
If $smallid = '5456' then $mpg = 'Mouse'
If $smallid = '5434' then $mpg = 'Speakers'
If $smallid = '5432' then $mpg = 'Cable'
If $smallid = '5431' then$mpg = 'Adapters'
and etc, etc. I think a else if statement is not practical because the value of $smallid could be about 150 different values.
Please help.