ID: 10695
Updated by: cardinal
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Bogus
Bug Type: Class/Object related
Operating system: 
PHP Version: 4.0.4pl1
Assigned To: 
Comments:

This is a scoping issue.  In order to see $newuser from within the fetch_pakete 
method, you need to declare $newuser global.

http://www.php.net/manual/en/language.variables.scope.php

Previous Comments:
---------------------------------------------------------------------------

[2001-05-07 02:16:49] [EMAIL PROTECTED]
Hello.

I have got a "standard" install of PHP 4.0.4pl1. So there is nothing special about it.

Here is the code extract:

#$result Data is successfully retrieved from mysql database)
class auth_user {
var $md_paketnummern;
function auth_user($username,$password,$database,$auth_table,$conn_id) {
$this->md_paketnummern=explode("|",$result[pakete]);
}
}

class fetch_pakete {
        function fetch_pakete(){
# Now comes the LINE!!! 
foreach($newuser->md_paketnummern as $arraykey => $paketnummern){
                        echo $paketnummern;
                }
        }
}


Now I call $newuser = new auth_user;
then: netpaket = new fetch_pakete;

When I replace $newuser->md_paketnummern with an argument, it works fine. With this 
version it does not.

---------------------------------------------------------------------------



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=10695&edit=2


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to