Is anyone taking advantage of PDO yet in their games? I'm trying to learn about proper PDO/DB connections in a pbbg context and I have yet to come across one on here, github, or anywhere else that offers open source. Just curious if pbbg makers are just content on the deprecating mysq_* or what?
After going through all the options for my upcoming game I've decided on using PDO but as a beginner it is super hard to find example code. I'm not interested in frameworks as I thought I would. Just a simple OO game with a PDO connector.
Database Connection
Database Connection
Unnamed Wrestling PBBG in Production
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Database Connection
Only the mysql extension is deprecated, not mysqli. If you use prepared statements in mysqli, they work great and are quite secure. That being said, when I do use PHP, I am usually going to use either an Active Records pattern library (usually included with whatever MVC framework I am using), or a full-on ORM solution such as Doctrine. These probably use PDO under the surface, but I don't typically work with it directly.
The indelible lord of tl;dr
Re: Database Connection
This YouTube video may help out (it did for me):
PHP Tutorials: PDO: Connecting to a Database (Part 1/7) - YouTube
http://www.youtube.com/watch?v=XQjKkNiByCk
A seven series video and does go over security. This is what I did like of it, of how to prevent SQL Injections.
PHP Tutorials: PDO: Connecting to a Database (Part 1/7) - YouTube
http://www.youtube.com/watch?v=XQjKkNiByCk
A seven series video and does go over security. This is what I did like of it, of how to prevent SQL Injections.
Sign off,
Hamilton
Hamilton
Re: Database Connection
This! I got to admit, i haven't been using PHP without a CMS Framework, or a MVC framework for many year now, so i usually learn whatever they are shipped with. But i vote for Doctrine, specially with Mongodb driver, it is just aawesome, if you are a js nerd like meJackolantern wrote:Only the mysql extension is deprecated, not mysqli. If you use prepared statements in mysqli, they work great and are quite secure. That being said, when I do use PHP, I am usually going to use either an Active Records pattern library (usually included with whatever MVC framework I am using), or a full-on ORM solution such as Doctrine. These probably use PDO under the surface, but I don't typically work with it directly.
- Jackolantern
- Posts: 10891
- Joined: Wed Jul 01, 2009 11:00 pm
Re: Database Connection
I have actually not used PHP much since I first tried out and liked MongoDB, so I didn't know it would map well to it, or really if it was compatible at all. Honestly, document and object databases really remove the need for a lot of the data layer complexity for things such as ORMs, in my experience. I usually just tend to use MongoDB straight. I am assuming there are still good benefits for using something like Doctrine with Mongo? Because it never actually occurred to me to look into it. It also seemed like Mongo stored data out of the box in the form you were using an ORM to finesse relational data into.
The indelible lord of tl;dr