Jump to content

To PDO or not to PDO


Paulieboy

Recommended Posts

I currently am doing a little work on a seasonal website for our golf league and wanted to improve the content with some databases. Going online and reading some articles regarding doing this I came across the issue of whether to write my code using SQL object oriented, SQL procedural or I guess what is the latest and greatest scripting, PDO. What I have read is that if I have any thought of changing over to another database type other than SQL, PDO would be the way to go. But my thought is that I most likely would not because I not only may never deal with other types of databases but I do not think that all these Hosting sites which SQL is most likely ingrained in would change and make their thousands of customers recode all their scripts. “Am I wrong” When I was taught PHP/SQL, I believe it was using the Procedural method, which appears not to be far from the object oriented script. PDO seems to be a little more involved in learning its syntax. What would your recommendations be for me? I would learn the PDO method if you think it would be beneficial. But if not necessary, I will stick to what I already feel comfortable with.

All comments greatly appreciated.

P

 

Link to comment
Share on other sites

PDO is the modern way, your only other option would be to use the mysqli extension. There's no reason to use the old mysql extension. Regardless of whether or not you use PDO or mysqli, you should make sure that you're using prepared statements and not just putting variables and things directly into SQL queries. Both PDO and mysqli support prepared statements.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...