Gdn::database PHP Method

database() public static method

Get a reference to the default database object.
public static database ( ) : Gdn_Database
return Gdn_Database
    public static function database()
    {
        return self::factory(self::AliasDatabase);
    }

Usage Example

 protected function _GetData()
 {
     $Px = Gdn::database()->DatabasePrefix;
     $Sql = "show table status where Name in ('{$Px}User', '{$Px}Discussion', '{$Px}Comment')";
     $Result = array('User' => 0, 'Discussion' => 0, 'Comment' => 0);
     foreach ($Result as $Name => $Value) {
         $Result[$Name] = $this->getCount($Name);
     }
     $this->setData('Totals', $Result);
 }
All Usage Examples Of Gdn::database