Subversion-Projekte lars-tiefland.inventar

Revision

Revision 5 | Revision 7 | Zur aktuellen Revision | Details | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
4 lars 1
<?php
2
 
3
	//$Id: comp.class.php 6 2008-05-10 16:29:22Z lars $
4
 
5
/**
6
 * @author Lars Tiefland <ltiefland@gmail.com>
7
 * @copyright 2008
8
 * @project Inventar Datenbank
9
 *
10
 */
11
 
12
	class comp{
13
		private $id;
14
		private $name;
15
		private $os_id;
16
 
17
		function __construct($id=0)
18
		{
19
			if($id)
20
			{
21
				$res=$GLOBALS["db"]->query("SELECT * FROM computer WHERE id=$id");
22
				$this->id=$id;
5 lars 23
				$row=$res->fetchRow();
4 lars 24
				$this->name=$row["name"];
25
			}
26
			else
27
			{
28
				$this->id=0;
29
				$this->name='';
30
				$this->os_id=1;
31
			}
32
		}
33
		static function get_computers($start=0,$limit=0)
34
		{
35
			$sql="SELECT * FROM computer";
36
			if($limit)
37
			{
38
				$res=$GLOBALS["db"]->limiquery($sql,$start,$limit);
39
			}
40
			else
41
			{
42
				$res=$GLOBALS["db"]->query($sql);
43
			}
5 lars 44
			while($row=$res->fetchRow())
4 lars 45
			{
46
				$comp[]=$row;
47
			}
48
			return $comp;
49
		}
50
	}
51
 
52
?>