i dont think so because both errors refer to the first line of the foreach statement.
foreach ($header as $element)
and the other one which is the same
foreach ($header as $element)
please help me this is annoying the shit outta me.
You don't show the assignment of $header. Are you sure that it is an array?
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
$header is assigned in a different php file, the file from which it is called.....this may be part of the problem, in that it's not recognizing it as an array after it's passed to the function definition in a separate file. but $header is initialized as such:
// HTML <TABLE> column headers
$header[0]["header"] = "Id";
$header[1]["header"] = "Network";
$header[2]["header"] = "Mask";
$header[3]["header"] = "Size";
$header[4]["header"] = "Type";
$header[5]["header"] = "Router Info";
$header[6]["header"] = "Description";
$header[7]["header"] = "Member Id";
$header[8]["header"] = "User";
$header[9]["header"] = "Assigned";
// query attributes to display in <TABLE> columns
$header[0]["attrib"] = "id";
$header[1]["attrib"] = "network";
$header[2]["attrib"] = "mask";
$header[3]["attrib"] = "size";
$header[4]["attrib"] = "type";
$header[5]["attrib"] = "router_info";
$header[6]["attrib"] = "description";
$header[7]["attrib"] = "member_id";
$header[8]["attrib"] = "user";
$header[9]["attrib"] = "assigned";
and you have an include for that file in your file with the foreach? I don't see a reason that $header would not be a valid parameter for the foreach, unless it's not been defined yet as that array.
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
What does the 'next' link look like when you hover over it? Is the script name correct? Where is the code in your page that calls the browse() function? It may not be passing the correct parameters.
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
Do you have "register_globals = Off" or is it on? The default is off I believe, which means you cannot access the offset with just $offset. You will need use:
$offset = $_GET['offset'];
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
thanks that worked perfectly.
Glad to hear it. Things like that can be very confusing with differences in runtime settings.
With register_globals turned on, all variables from GET and POST are automatically available as a global variable and can be accessed as $variableName. When register_globals is off, you must retrieve the variable from $_GET[] or $_POST[] yourself to use it. The code that you were using from the book obviously had register_globals turned on.
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
the actual code from the book didnt have register_globals turned on, but i think that is the default setting for the vbersion on php that i'm using. that is a config file setting, right?
Yes, it's a setting in your php.ini file.
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847