Revision 37 | Revision 111 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed
<?class Spiele{var $g_id;var $g_name;var $g_m1;var $g_m2;var $g_g1;var $g_g2;var $g_location;var $g_date;var $g_type;function __construct($g_id){global $db, $db_meld, $error, $meld, $user;$sql="SELECT * FROM games WHERE g_id=$g_id";$res=$db->query($sql);if (true == DB::isError($res)){$error=true;$meld="Ein Fehler ist aufgetreten!";$db_meld=$res->getUserInfo();return $error;}else{$row=$res->fetchRow();$this->g_id=$g_id;$this->g_name=$row["g_name"];$this->g_m1=$row["g_m1"];$this->g_m2=$row["g_m2"];$this->g_g1=$row["g_g1"];$this->g_g2=$row["g_g2"];$this->g_location=$row["g_location"];$this->g_date=$row["g_date"];$this->g_type=$row["g_type"];return $this;}}function Spiele($g_id){$this->__construct($g_id);}function update($g_name, $g_m1, $g_m2, $g_g1, $g_g2, $g_location, $g_date, $g_type){$this->g_name=$g_name;$this->g_m1=$g_m1;$this->g_m2=$g_m2;$this->g_g1=$g_g1;$this->g_g2=$g_g2;$this->g_location=$g_location;$this->g_date=$g_date;$this->g_type=$g_type;}function save($op){global $db;switch($op){case "save":$sql="INSERT INTO games (g_name, g_m1, g_m2, g_g1, g_g2, g_location, g_date, g_type)VALUES ('$this->g_name', $this->g_m1, $this->g_m2, $this->g_g1, $this->g_g2, $this->g_location, $this->g_date, $this->g_type)";break;case "update":$sql="UPDATE games SET g_name='$this->g_name', g_m1=$this->g_m1, g_m2=$this->g_m2, g_g1=$this->g_g1, g_g2=$this->g_g2, g_location=$this->g_location, g_date=$this->g_date, g_type=$this->g_type WHERE g_id=$this->g_id";break;case "delete":$sql="DELETE FROM games WHERE g_id=$this->g_id";break;}return $db->query($sql);}function ListSpiele($limit, $start=0){global $db, $db_meld, $error, $meld, $user;$sql="SELECT * FROM games";if ($db->provides('limit') && $limit > 0){$res=$db->limitquery($sql, $start, $limit);}else{$res=$db->query($sql);}if (true == DB::isError($res)){$error=true;$meld="Ein Fehler ist aufgetreten!";$db_meld=$res->getUserInfo();}return $res;}}?>