War_Hero Posted June 10, 2009 Posted June 10, 2009 Hi all. :) I haven't posted on here in some time, as I stopped coding for a few months due to exams. Now that I've got back into coding again, I need to refresh my memory...as such. I've been on working on a mod and have come across an error, which seems like a simple one but I can't figure it out, yet I've racked my mind for a solution yet can't find one. This is the error I'm getting: Fatal error: Call to undefined function furnidx() in /usr/home/*****/domains/*****/public_html/housing.php on line 168 Here is the area of code which is causing me hassle: function buy_furniture() { global $db,$ir,$c,$h,$userid,$house,$userhouse,$house_settings; if($db->num_rows($house) > 0) { switch($_GET['act2']) { case 'idx': furnidx(); break; case 'furnlist': furn_list(); break; case 'buy': buy(); break; default: furnidx(); break; (this is line 168) } } else { die("You don't have a house. <a href = 'index.php' />Go Back</a>"); } Before any of you say it, yes, I do have a function for each of the defined ones above. :) But for some reason I'm getting this error. Could anyone explain to me what I can do to sort this out, please? If you need me to post more of the code, I will. Any help will be greatly appreciated. :) Quote
War_Hero Posted June 11, 2009 Author Posted June 11, 2009 Re: Function help Nobody? :| I know it may seem like an elementary question/problem, but I just can't solve it. I usually don't ask for help, but as I've just come back into coding, I need some, just to solve this little problem. :) Quote
wolfe Posted June 11, 2009 Posted June 11, 2009 Re: Function help I guess my first question is: Where is the function located? Quote
War_Hero Posted June 11, 2009 Author Posted June 11, 2009 Re: Function help Ahh yeah, that would be helpful, wouldn't it? :) Here is function furnidx(): function furnidx() { global $db,$ir,$c,$h,$userid,$house,$userhouse,$house_settings; print "Hello. Please select an option from below: <font color = blue /><a href = '{$_SERVER['PHP_SELF']}?action=buyfurniture&act2=furnlist' />Buy Furniture</a></font>"; } That is within the function buy_furniture(). Quote
CrazyT Posted June 11, 2009 Posted June 11, 2009 Re: Function help You can't use a function inside another function.. you can call the function yeah.. Quote
War_Hero Posted June 11, 2009 Author Posted June 11, 2009 Re: Function help I think you can because the exact same method is used in the script yourgang.php. Within the gang_staff() function, there are other functions, like declaring war, managing the gang vault, etc. So I'm confused...what is the difference with what I'm doing? Quote
Haunted Dawg Posted June 11, 2009 Posted June 11, 2009 Re: Function help these functions: case 'idx': furnidx(); break; case 'furnlist': furn_list(); break; case 'buy': buy(); break; default: furnidx(); break; (this is line 168) Need to be outside of function buy_furniture() Quote
War_Hero Posted June 11, 2009 Author Posted June 11, 2009 Re: Function help Thank you very much. :) I had to tweak a few things afterwards to get it to work, but it works. :) Quote
Magictallguy Posted June 13, 2009 Posted June 13, 2009 Re: Function help You can't use a function inside another function.. you can call the function yeah.. ... yes you can -.- Quote
CrazyT Posted June 13, 2009 Posted June 13, 2009 Re: Function help You can't use a function inside another function.. you can call the function yeah.. ... yes you can -.- Hm your correct lol -> http://us2.php.net/manual/en/language.functions.php Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.