PHP

PHP Scripts

PHP MySQL wrapper - PHP Class to easily call mysql database functions

Description

  • This is not a full script. This is the MySQL class that I used with PHP4 database projects. I ran all my MySQL connections through it because it saves time and space on code. I don't have to keep typing the database information and other things like that. It also has shortcut functions because I got tired of escaping data, stripping slashes, building UGLY insert and update queries. I'm sharing this class along with some examples for using it.

PHP Random Password Generator

Description

  • This script allows you to create your own list of passwords based off a specific set of parameters. You can either use my copy of the script (listed below under "See it in use") to generate passwords, or you can download a copy of the PHP script and make your own modifications.
  • I constantly found myself needing to create new passwords, either for myself or clients. I HATE passwords that I can't tell what the characters are by just looking at it. I also got tired of clients contacting me because they can't figure out if their password contained a 1, l, I or o, O, 0 when they read the old password they taped to the bottom of their keyboard (yes, we know you do that).

PHP MySQL wrapper v3 - PHP5 Singleton Class to easily call mysql functions

Description

  • This is not a full script. This is the PHP singleton class (PHP5 specifically) that I use to make all the MySQL database calls in my projects. I run all my MySQL connections through it because it saves me time and space on my code. I don't have to keep typing the database information and other things like that. It also has shortcut functions because I got tired of escaping data, stripping slashes, building UGLY insert and update queries. I'm sharing this class along with some examples for using it.

What is a Singleton and why use it?

  1. A Singleton in PHP allows you to create a single object ($db) and reuse that same existing object anywhere in your code.
  2. This allows you to easily reuse the same database connection inside of other functions/classes. Without a singleton, your options would be to either declare the $db object as a global inside every function, or pass the $db object into the function via a parameter. A Singleton object eliminates all this.
Subscribe to RSS - PHP