![]() |
Two almost identical methods but one failing - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Two almost identical methods but one failing (/showthread.php?tid=38597) |
Two almost identical methods but one failing - El Forum - 02-12-2011 [eluser]edjon2000[/eluser] Hello again I am rewriting my web project to take into account CI Reactor and making a few design improvements on the way, however, I have run into a problem which for the life of me I cannot understand. I will try to break it down as best as I can:- Initially I created a method to generate values for a dropdown list and have since extended that to include some other pages on this project, so far, everything has worked out correctly, apart from this one variation( I do a lot of copying and pasting and just change the variables - as you will see shortly - ![]() Here is the method that works correctly:- Code: // under development Code: // under development I could be missing something obvious and I apologise if I have, I have been trying to sort this out for the past four hours so I could be a bit "punch-drunk". Anyway this is the error I am getting:- Code: A PHP Error was encountered Jon Two almost identical methods but one failing - El Forum - 02-12-2011 [eluser]cahva[/eluser] Does the former return anything as now it would definately give syntax error or did you just forgot to paste the whole method? ![]() Was it supposed be like this: Code: function create_client_list() Two almost identical methods but one failing - El Forum - 02-12-2011 [eluser]edjon2000[/eluser] Oh! (lots of really bad words you wouldn't want your mother to know that you knew), it was the final return $query statement that was missing) Thank you cahva ![]() edit ... Actually I never thought about defining the $query variable as FALSE to start with although, it would make for better programming practices, so whilst it is not needed in this instance it is probably a good idea to initialise all variables before they are used, I generally do that with my $data arrays prior to building views, form input statements etc What do you think ? Jon |