![]() |
Else condition error in model - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Else condition error in model (/showthread.php?tid=63939) |
Else condition error in model - Codeigniter_Learner - 12-25-2015 Hi, Trying to learn Codeigniter. I have this form where I am trying to load dropdown value from db. I if I use this code in model, it works fine: Code: function getData($loadType,$loadId){ Since I need one more field to load, and I add this, I get error: Code: function getData($loadType,$loadId){ Parse error: syntax error, unexpected 'else' (T_ELSE) in C:\xampp\htdocs\drop\application\models\model.php on line 28 Is there anything wrong with this code? RE: Else condition error in model - skunkbad - 12-25-2015 You can't chain more than one "else" together. It should be: if else if else not if else else RE: Else condition error in model - Php - 12-25-2015 Code: function getData($loadType,$loadId){ RE: Else condition error in model - Happy Camper - 12-26-2015 change your condition to PHP Code: if ($variable == "value1"){ |