RopeADope Posted June 15, 2010 Share Posted June 15, 2010 I've never done any OOPHP and I'm trying to get my head wrapped around the concept. I think I've got it but I have a question. Isn't OOPHP like databasing without actually using a database? This is my understanding of how it works... OOPHP class X{ functionY(p1,p2,p3){ property1 property2 property2 } } do_functionY(p1,p2,p3); PHP&DB (input to DB here) for(xxxxx){ mysql_result(p1); mysql_result(p2); mysql_result(p3); } while(i>0){ echo "p1,p2,p3"; } I know the examples aren't syntactically correct but I was trying to be brief, and they get my point across. I've read a bunch of tutorials and such for OOPHP but I don't understand the purpose when databasing does the same thing(at least in my mind ). Any help would be much appreciated, I've been debating this for some time now... Quote Link to comment https://forums.phpfreaks.com/topic/204854-oophp-vs-phpdb/ Share on other sites More sharing options...
KevinM1 Posted June 15, 2010 Share Posted June 15, 2010 No, they're not the same. You can use objects to mimic a database's structure and behavior. But there's far more they can do than just that. Read up on composition, inheritance, and polymorphism. Quote Link to comment https://forums.phpfreaks.com/topic/204854-oophp-vs-phpdb/#findComment-1072406 Share on other sites More sharing options...
kenrbnsn Posted June 15, 2010 Share Posted June 15, 2010 Take a look at this tutorial: Object Oriented PHP for Beginners Ken Quote Link to comment https://forums.phpfreaks.com/topic/204854-oophp-vs-phpdb/#findComment-1072414 Share on other sites More sharing options...
RopeADope Posted June 15, 2010 Author Share Posted June 15, 2010 Ok, so OOPHP and PHPDB need to be essentially put on the same level, as in they coexist instead of one relying on or replacing the other, correct? My question arises from my current project, a car audio website. I'm trying to figure out how to apply OOPHP to that car audio website. Right off the bat, I know I can apply OO concepts to a shopping cart, and the car audio items, but I'm not sure how much further it can go(as I have limited knowledge of OO). Hypothetical Q: Could you treat an entire website as an object? e.g. class website{ var $my_website __construct(my_website){ function header(){ } function body(){ } Ok, so OOPHP and PHPDB need to be essentially put on the same level, as in they coexist instead of one relying on or replacing the other, correct? My question arises from my current project, a car audio website. I'm trying to figure out how to apply OOPHP to that car audio website. Right off the bat, I know I can apply OO concepts to a shopping cart, and the car audio items, but I'm not sure how much further it can go(as I have limited knowledge of OO). Hypothetical Q: Could you treat an entire website as an object? e.g. class website{ var $my_website __construct(my_website){ function header(){ } function body(){ } Ok, so OOPHP and PHPDB need to be essentially put on the same level, as in they coexist instead of one relying on or replacing the other, correct? My question arises from my current project, a car audio website. I'm trying to figure out how to apply OOPHP to that car audio website. Right off the bat, I know I can apply OO concepts to a shopping cart, and the car audio items, but I'm not sure how much further it can go(as I have limited knowledge of OO). Hypothetical Q: Could you treat an entire website as an object?(or am I making this way too abstract? lol) e.g. class website{ var $my_website __construct(my_website){ function header(){ } function body(){ } function footer(){ } } Quote Link to comment https://forums.phpfreaks.com/topic/204854-oophp-vs-phpdb/#findComment-1072433 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.