Adding more options to an If Statement
Posted: Thu Dec 04, 2003 12:16 am
I'm rather new at PHP and having been trying to modify these two lines to work with four options instead of two
if ($this->db->VARS["allow_age"]==1) {
$AGE= ($this->age==20) ? " <img src=\"img/20.gif\" width=\"12\" height=\"12\">" : " <img src=\"img/30.gif\" width=\"12\" height=\"12\">";
}
if ($this->db->VARS["allow_age"]==1) {
$AGE = ($row['age']==20) ? " <img src=\"img/20.gif\" width=\"12\" height=\"12\">" : " <img src=\"img/30.gif\" width=\"12\" height=\"12\">";
}
I want this to display a different image if the variable is 20, 30, 40 or 50. and not just 20 and 30. I have tried everything I can think of. Any help. Thanks ahead of time
if ($this->db->VARS["allow_age"]==1) {
$AGE= ($this->age==20) ? " <img src=\"img/20.gif\" width=\"12\" height=\"12\">" : " <img src=\"img/30.gif\" width=\"12\" height=\"12\">";
}
if ($this->db->VARS["allow_age"]==1) {
$AGE = ($row['age']==20) ? " <img src=\"img/20.gif\" width=\"12\" height=\"12\">" : " <img src=\"img/30.gif\" width=\"12\" height=\"12\">";
}
I want this to display a different image if the variable is 20, 30, 40 or 50. and not just 20 and 30. I have tried everything I can think of. Any help. Thanks ahead of time