Tag Archives: mysql

MySQL Singleton Class to allow easy and clean access to common mysql commands

The MySQL Database class is implemented using the singleton design pattern. This design pattern allows for only one single instance of the object. This one instance can then be obtained through a static method. This provides a convenience in that you can get your database object from anywhere in your code.
Continue reading

Database PHP Session Handling

Database PHP Session Handling

As you should be aware the HTTP protocol, as used for serving web pages, is completely stateless. This means that after the server has received a request, processed it and sent a response, the process which dealt with that request dies. Anything that the process had in its memory therefore dies with it, so when a subsequent request is received from the same client it is unable to refer to its memory about anything that happened previously.
Continue reading

Restoring MySQL Dump with PHP

As web developers, we are usually tasked with deploying a project to a production server that we don&squo;t always have access to. And in most cases the projects require a database. The usual plan of action consists of running a database dump, copying the sql sump file over to the production server, and restoring the dump file using the MySQL CLI. However, in cases where we have limited access to the production server including no shell access, results in the problem: How do we install the database.

Using Mysql From Shell Scripts

Using Mysql From Shell Scripts

Running mysql from a shell is not really a bash specific concern, but what we will be getting into for starters is running mysql from a shell script using the bash scripting syntax. For starters some of the concerns we may have are protecting passwords from the history file, and how to specify parameters on the command line without being prompted. Continue on the next section to find out more.

Continue reading