Echoing a Variable from a Object


Posted on 16th Feb 2014 07:03 pm by admin

How do I get a variable from the new User Class to echo out in this clasS?

class MyApp
{
Did you know?Explore Trending and Topic pages for more stories like this.

function __construct()
{
global $dbHost;
global $dbUser;
global $dbPass;
global $dbName;

$this->DB = new Database;
$this->DB->connect($dbHost, $dbUser, $dbPass, $dbName);

$User = new User;

echo $User->login;
echo $this->User->login;

}


}

No comments posted yet

Your Answer:

Login to answer
271 Like 8 Dislike
Previous forums Next forums
Other forums

Sql and php order list script problems
Hi im having a few problems with trying to get the coding right on a orders list ive done (or trying

Add weeks in a query?
I have a SQL that summarizes the quantity per week. The weeks that has no value does not exist in th

setcookie and isset($_COOKIE(name)) seem very finnicky.
I'm currently playing around with a user system with login and registration. I'm trying to use cooki

PHP and MySQL on intranet?
Is it possible to use both these on an intranet network?

Need help making a blockquote and line items conditional
I have some code I bought a few years ago that allows my clients to update content on their site usi

XML Grouping
I'm using xml_parse_into_struct to get all my elements, but now I need to group them. For example, h

Check if another session of the page is running?
I want to keep people from opening multiple tabs, or sessions of my Facebook app. Is it possible to

PHP page is blank
Hi Everyone,

I have a site in which I am able to open the first PHP webpage in my browser but

Looping Problem
I've got a client that has a database with about 200 events at any given time. I'm trying to loop t

Getting PHP to ammended the selected in option field
Hey Guys

thanks for everyones help so far. This site and its users are oozing awesomness.

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash