Location: PHPKode > scripts > Persistent Objects for PHP > persistent-objects-for-php/core/POPDB.php
<?php

	/**
	 * Class used for creating the database connections for the POP lib
	 * 
	 * @package pop
	 * @subpackage core
	 */
	abstract class POPDB
	{
		/**
		 * Connection collection
		 * @var array
		 */
		protected static $conns;
		
		/**
		 * Add a connection to the collection
		 * @param $conn_name - Name for the connection
		 * @param $driver - Driver
		 * @param $server - Server name/IP
		 * @param $dbname - Database name
		 * @param $user - Database User
		 * @param $password - User password
		 * @return void
		 */
		public static function addConnection($conn_name, $driver, $server, $dbname, $user, $password)
		{
			if (!is_array(self::$conns))
				self::$conns = array();
			self::$conns[$conn_name] = new PDO($driver.':host='.$server.';dbname='.$dbname,$user,$password);
		}
		
		/**
		 * Get the connection
		 * @param $conn_name - Name of the connection
		 * @return PDO Object
		 */
		public static function getConnection($conn_name)
		{
			return self::$conns[$conn_name];
		}
		
	}
?>
Return current item: Persistent Objects for PHP