heeha Posted August 16, 2015 Share Posted August 16, 2015 For the first time i will be trying to add any databases to my site( well the website is first in php as well taking help from this forum itself), which database would be good for me( a begineer). Procedural, object orients or PDO ( im not sure all webhost offers this or not ). What is the basic difference between object oriented and procedural databases? Quote Link to comment Share on other sites More sharing options...
requinix Posted August 16, 2015 Share Posted August 16, 2015 You mean procedural and object-oriented code for interacting with databases? Because databases themselves are... neither. Question doesn't make sense. Procedural tends to mean a lot of copy and paste, with all the bad things that can mean. Object-oriented makes nicer code. Quote Link to comment Share on other sites More sharing options...
heeha Posted August 16, 2015 Author Share Posted August 16, 2015 Yes, i meant that which codes would be best, object oriented code or procedural code for interacting with databases? What does procedural tends to mean a lot of copy and paste? Quote Link to comment Share on other sites More sharing options...
requinix Posted August 16, 2015 Share Posted August 16, 2015 (edited) Because whenever you want to run a query, you'll find yourself going to some other place in code where you do a query, copying the code there to connect to the database (because you don't remember the server or username or password), and pasting it in the new code. And if anything there changes, like if you moved to a new host, then you'd have to go through the code you have, change the information, then copy and paste the changed code to everywhere else you need. With OOP you put most of that code into a class. There's still some code that you write/copy elsewhere, but there's less of it and it's much less likely to change in the future. Edited August 16, 2015 by requinix Quote Link to comment Share on other sites More sharing options...
Barand Posted August 16, 2015 Share Posted August 16, 2015 ... or you could put the connection credentials in a separate file which you include() in your scripts so they only need change one place. This applies to procedural and OOP. Quote Link to comment Share on other sites More sharing options...
gizmola Posted August 16, 2015 Share Posted August 16, 2015 The bigger question these days is: -Relational data store (mysql,postgresql,oracle,sqlserver) or non-relational/nosql/document oriented (mongodb, cassandra, couchbase) -if relational, straight API vs db class? -if db class, create your own vs use existing - if db class, use ORM (doctrine2, propel, laravel eloquent) Quote Link to comment Share on other sites More sharing options...
requinix Posted August 17, 2015 Share Posted August 17, 2015 ... or you could put the connection credentials in a separate file which you include() in your scripts so they only need change one place. This applies to procedural and OOP.Shh. 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.