Jump to content

Archived

This topic is now archived and is closed to further replies.

minuteman

Warning: Missing argument 8 for pagebrowser() SOLVED

Recommended Posts

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?

Share this post


Link to post
Share on other sites
It's basicaly saying that where you call the function e.g.

//all your code
pageBrowser('totalrows','numLimit','amm','queryStr','numBegin','begin','num');
//rest of your code

You are still only giving it 7 things instead of 8 therefore not passing the last variable at all

Regards
Liam

Share this post


Link to post
Share on other sites
Thanks Liam

I 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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.