Tagged Questions

The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
61 views

PDO MySQL class

I'm new to using PDO and am trying to create a secure class to handle MySQL statements. Here is what I have so far: class SQL { private static $dbh = null; private function __construct($host, $user, ...
0
votes
2answers
81 views

User lib php v2

I've been working some forth looking on design patterns, and I would like some help to improve the code (fixes, tips, just generally improvements, or things you consider bad practise, etcetera in my ...
3
votes
1answer
145 views

Using PHP's __call() to emulate a Class instead of Extending

I recently started working on a project that had been dropped by the previous dev. When looking through the existing code, I came across this singleton Database Class. class Database{ private static ...
2
votes
1answer
77 views

Right way to update only certain field on a database row

I have data that I want to insert on a database. Sometime a piece of data is already in the database, so I just want to update the fields that changed. For example if I insert these rows one after ...
2
votes
1answer
310 views

PHP DAO classes inherit from a generic DAO classes and only change the table name

I am building a web app that needs to access various tables in a given MySQL db. To do that, I have created a generic class, see DAO_DBRecord.php below, and I create children classes for each table I ...
2
votes
2answers
310 views

PHP: PDO (mysql) connection and query class, safety and logic

For the last few day I tried to figure out how to work with mysql and PDO. All tough I've tried to read a lot about the subject, still there are a lot of things I don't understand. Because of this ...
2
votes
1answer
369 views

PDO wrapper class

Connection stored in the xml config file. <?xml version='1.0' ?> <database> <connection> <dbtype>mysql</dbtype> <dbname>shoutbox</dbname> ...
1
vote
1answer
193 views

MySQL PDO class

Please give me any comment about these codes. Does it enough to prevent SQL injection? What I have to do to make the code better? <?php /** * Description of MySql * @name MySQL PDO ...
10
votes
3answers
634 views

PHP PDO Database Abstraction Layer

I'd like to get some feedback on a PHP Databse Abstraction Layer I've created. It's a little long, but there really wasn't a way to just post part of it. Here is the base DBObject class for MySQL: ...
3
votes
2answers
891 views

PDO wrapper class

<?php class Database { private $_dbh; private $_stmt; private $_queryCounter = 0; public function __construct($user, $pass, $dbname) { $dsn = ...
1
vote
1answer
58 views

Using PDOs to import file data to database, what is wrong with this code?

More than likely, the query isn't built correctly as I am fairly green with SQL. <? $i=0; foreach($AddedProducts as $AddedProduct) { $i++; echo ...
3
votes
2answers
383 views

How can I improve this PHP MySql Rank generation function?

How can I improve this PHP MySql Rank generation function? (Mostly looking to improve speed, but any feedback is very welcome) Right now I keep stats and ranks in 2 separate tables. The only ...
3
votes
2answers
311 views

Implementing PDO, code correct so far?

I have decided to go PDO and have started implementing it on one of my webprojects. I have limited programing skills but can usually pull it off with some tutorials and forums. Here is my code this ...
2
votes
2answers
209 views

Gathering data from database

The following code has one of the most confusing lines I've ever wrote. I can imagine ten other way to write it but I do not know which else could be any better. So I'm here to ask you fellows how ...
5
votes
5answers
2k views

Database class using PDO

The point of this question What about this piece of code? I'm actually using it while developing a simple application and it seems to cover all my needs. Also it uses PDO so that we don't really have ...

1 2
15 30 50 per page