Файл: include/things.php
Строк: 45
<?php
/**
class things in db
*/
include_once("base.php");
class CThings extends CBase
{
/**
Constructor
*/
function CThings($database)
{
$this->db=$database;
$this->table_name=$GLOBALS['table_objects'];
}
/**
Get all things in database
*/
function getCountThings()
{
$sql = "select count(*) from $this->table_name";
$result = $this->execSQL($sql);
$row = $result->fetchRow();
return $row[0];
}
function getAllThingsType($type)
{
$sql = "select vnum from $this->table_name where type='$type'";
$result = $this->execSQL($sql);
$things = array();
//cycle on all things
while($row = $result->fetchRow())
{
$things[]=array("vnum" => $row[0]);
}
return $things;
}
function getAllThingsMaterial($material)
{
$sql = "select vnum from $this->table_name where material='$material'";
$result = $this->execSQL($sql);
$things = array();
//cycle on all things
while($row = $result->fetchRow())
{
$things[]=array("vnum" => $row[0]);
}
return $things;
}
}
?>