ridiculous Posted March 14, 2009 Share Posted March 14, 2009 [1] I'm trying to make a PDO connection into an object and pass the connection to outside classes. [2] I can do this when I put the PDO connection in a constructor but not when I put it in a public method. [3] I have the code pasted here : http://www.pastebin.ca/1360597 [4] I am monitoring this thread closely so please ask away if I can clarify anything. Thanks in advance Quote Link to comment Share on other sites More sharing options...
TonyCastle Posted March 14, 2009 Share Posted March 14, 2009 Hi, if I'm missing something I apologise in advance I only started looking at OOP myself this weekend but it seems that in the example that doesn't work your class doesn't have a constructor or extend a class that does have a constructor and neither is it abstract, how do you instantiate it? Quote Link to comment Share on other sites More sharing options...
corbin Posted March 14, 2009 Share Posted March 14, 2009 connect_1 is the return value of connect() which does not return anything. So you're print_r()ing a null value. 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.