Possible Duplicate:
nested php ternary trouble: ternary output != if – else
Why this work:
if($db->f('item_bonus') > 0)
$bonus = $db->f('item_bonus').' (i)';
elseif($db->f('manufacturer_bonus') > 0)
$bonus = $db->f('manufacturer_bonus').' (m)';
elseif($db->f('category_bonus') > 0)
$bonus = $db->f('category_bonus'). ' (c)';
but this, don’t work:
$bonus = $db->f('item_bonus') > 0 ? $db->f('item_bonus').' (i)' : $db->f('manufacturer_bonus') > 0 ? $db->f('manufacturer_bonus').' (m)' : $db->f('category_bonus') > 0 ? $db->f('category_bonus'). ' (c)' : '0';
What I’m doing wrong? $db->f return number, float type.
Try it with grouping: