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
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?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.