Размер файла: 878B
<?php
class Elfi
{
public $container = [];
public static $instanse;
public function __construct(){}
public static function getInstanse()
{
if (self::$instanse == null)
{
self::$instanse = new self();
}
return self::$instanse;
}
public function query($sql,$args = null)
{
$data = mysql_query(
vsprintf(
$sql,$args
)
);
return $data;
}
public function fetch($sql,$args = null)
{
$data = mysql_fetch_assoc(
$this->query($sql,$args)
);
return (object) $data;
}
public function count($sql,$args = null)
{
$count = mysql_num_rows(
$this->query(
$sql,
$args
)
);
return $count;
}
/**
* До лучших времен.
*/
public function fetchAll($sql,$args = null)
{
while ($row = $this->fetch($sql,$args))
{
$this->container[] = $row;
}
return $this->container;
}
}