minuteman Posted October 1, 2006 Share Posted October 1, 2006 I'm running a php script that displays data in columns. There is a config setting for establishing the number of rows to display, after which it creates a second page, etc. There is a particular variable that works fine outside the function but is empty inside the function. If I understand right, this is normal since variables inside a function are different than variables outside the function. I need to know how to pass the variable into and out of the function.The funtion works fine like this function pageBrowser($totalrows,$numLimit,$amm,$queryStr,$numBegin,$begin,$num) {but if I add the code to it for the var I need ($search_value) like this - function pageBrowser($totalrows,$numLimit,$amm,$queryStr,$numBegin,$begin,$num,$search_value) {it crashes and I get the error message Warning: Missing argument 8 for pagebrowser()I've looked everywhere on the page for any other type of code naming the function but I can't find any. How do I get the value of the var $search_value passed to the function? Quote Link to comment Share on other sites More sharing options...
shocker-z Posted October 1, 2006 Share Posted October 1, 2006 It's basicaly saying that where you call the function e.g.//all your codepageBrowser('totalrows','numLimit','amm','queryStr','numBegin','begin','num');//rest of your codeYou are still only giving it 7 things instead of 8 therefore not passing the last variable at allRegardsLiam Quote Link to comment Share on other sites More sharing options...
minuteman Posted October 1, 2006 Author Share Posted October 1, 2006 Thanks LiamI still don't see it. I don't get any errors in the original code where there are only 7 vars. As soon as I ad number 8 ($search_value) to pageBrowser('totalrows','numLimit','amm','queryStr','numBegin','begin','num'); then I get the error. $search_value has a value in it all the way through the code in front of the call but not inside the function. Quote Link to comment Share on other sites More sharing options...
shocker-z Posted October 1, 2006 Share Posted October 1, 2006 but it's ok using an extra but where you call the function that has ot match it too are you sure that your adding that extra eliment to both the function creating and the function call?e.g. origonaly using[code]function blah($blah1) { return $blah1;}//loads of code$result=blah('You are logged in');[/code]and new code your doing like this[code]function blah($blah1, $blah2) { return $blah1.' - '$blah2;}//loads of code$result=blah('You are logged in as');[/code]therefore still only calling with $result=blah('You are logged in'); instead of $result=blah('You are logged in as', "$name");Liam Quote Link to comment Share on other sites More sharing options...
minuteman Posted October 1, 2006 Author Share Posted October 1, 2006 Hey, that got it! Thanks liam. javascript:void(0);Grin Quote Link to comment Share on other sites More sharing options...
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.