Jump to content

OOP - Packing DB connection in object


ridiculous

Recommended Posts

[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

Link to comment
https://forums.phpfreaks.com/topic/149367-oop-packing-db-connection-in-object/
Share on other sites

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?

Archived

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

×
×
  • Create New...

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.