PHP Classes

File: AzizMVC/databaseModel.php

Recommend this page to a friend!
  Classes of Aziz S. Hussain   Aziz MVC   AzizMVC/databaseModel.php   Download  
File: AzizMVC/databaseModel.php
Role: Class source
Content type: text/plain
Description: Data Model
Class: Aziz MVC
Framework that uses MVC design pattern
Author: By
Last change: Fixed Minor Bugs
Date: 13 years ago
Size: 1,581 bytes


Class file image Download
if(!defined('BASEPATH')){ die();}


AzizMVC By Aziz S. Hussain
Licensed under LGPL

File Name: databaseModel.php

class model

This class loads the database connection information based in /AzizMVC/configs.php

public $cLink --> Database connection link


void __construct --> Open the database and assign connection link
void getLink --> Returns the connection link
void closeLink --> Closes database connection link

// Model class
class model
    For the sake of encapsulation, variable should be private,
    but I found it much easier referring to the link itself instead of
    having to go through the getLink() function
    You can change it to public if you want
private $cLink;
// Constructor, get connection information
public function __construct()

// Include database oonfigurations

$this->cLink = @mysql_connect($MVC_Configs['databaseHost'],
$MVC_Configs['databaseUser'],$MVC_Configs['databasePassword']) or die(mysql_error());

# Select database
@mysql_select_db($MVC_Configs['databaseName'],$this->cLink) or die(mysql_error());
// Get database link resource
public function getLink()
// Close database link resource
public function closeLink()

// End of file /AzizMVC/databaseModel.php