8
votes
1answer
515 views

How is OOP achieved with configuration files in PHP?

Someone asked if their singleton is good for OOP: Using a singleton class to get and set program wide settings. However, the answer just provides tweaks to his existing code - but the question ...
3
votes
1answer
112 views

Going from Spaghetti PHP OOP to SOLID OOP

I am beyond stuck in a half way point between PHP structural and OOP, but I can never achieve proper SOLID patterns despite reading DI, IOC, and reading about the interfaces. Rather than to read ...
7
votes
2answers
495 views

Protect database from SQL Injection and similar attacks - PHP

I am doubtful about the security of my PHP code. I am new to programming, but want to learn how to secure things, protect my databases from SQL injection, and other best practices. I'd like to know if ...
5
votes
2answers
171 views

DB abstraction, private methods in OOP PHP library

This library registers a new user. Questions: Where should the DB class instantiation happen for user class? I tried instantiation in the constructor but that property doesn't seem to be available ...
2
votes
1answer
82 views

Class method with begin transaction and return errors

I've created a method which is useful for executing multiple queries, and it works perfectly. Is this a good way to handle this? ...
1
vote
1answer
92 views

Is there any better way to fetch two tables in one statement or query?

The 'Do' method is for prepared statements and returns (by fetchall()). I am also using two looping statements. Is there any better way to fetch two tables in one statement or query? If not, what ...
1
vote
3answers
436 views

Look over my code for PDO and MVC

I'm building this website with PDO and Pattern MVC. I'm currently working on the login page and would like to know if this structure is correct for MVC pattern. I'd also like your opinions and ...
4
votes
3answers
636 views

OOP how to show query

Here you go OOP :) ...
2
votes
1answer
767 views

Structure pages mvc + oop

I am developing a website and I want to use PDO and MVC. Before, I was coding in procedural MySQL, but I'm starting to understand the object-oriented programming. My problem is the following: If I ...
1
vote
4answers
319 views

Making this code 'more' OOP

I have just started to try and learn 'OOP' but it appears I'm doing this wrong, according to the people on StackOverflow the code below is far from Object Orientated, but I'm finding it hard as I'm ...
1
vote
1answer
1k views

Is this PHP class good enough for CRUD

I wrote this class to make it reusable in any project. It uses PDO as the MySQL connection. Beside not using Setters and Getters, is this code secure and good practice for CRUD ? Thanks for further ...
1
vote
1answer
889 views

What is the correct way to set up my classes in OOP programming in PHP?

Let me start with a little introduction. I am in the process of learning OOP in PHP. I have also researched Design Patterns but have not yet fully grasped the different types of concepts. I am at the ...
2
votes
1answer
621 views

OOP MySQL connection class

Under sage from another CR post I'm crafting an OOP MySQL connection/query class. Nothing new, but a place to start plying OOP PHP. Here is the current design,what would aid speed and portability? ...
1
vote
2answers
234 views

What can I do to make this class better?

I'm 100% sure improvements can be made. Any help is greatly appreciated. I should add that I am new to OOP and am not sure if I'm using this the right way. ...
8
votes
2answers
468 views

Object Paradigm for PHP, Practice in Design

I've created and I manage a point of sale web application built in PHP which has thus far followed no clear guidelines or methodology for development; it's operation is completely procedural. In turn, ...
5
votes
2answers
355 views

Database method to query

I have a database class that in __construct() initialize a PDO connection and insert the instance into a $db private var. Now i'm working on a method that can be ...