mourne_rcpp_fw/Mourne-CI/application/models/mo_common_model.php

72 lines
1.5 KiB
PHP
Raw Normal View History

2021-10-30 19:02:07 +02:00
<?php
class Mo_common_model extends MO_Model
{
public function __construct()
{
parent::__construct();
}
2021-10-30 19:02:07 +02:00
public function get_hero_data($userid)
{
$sql = "SELECT * FROM heroes WHERE userid = ? AND selected = '1'";
2021-10-30 19:02:07 +02:00
$q = $this->db->query($sql, array($userid));
2021-10-30 19:02:07 +02:00
if (!$q->num_rows()) {
return false;
}
2021-10-30 19:02:07 +02:00
return $q->row_array();
}
2021-10-30 19:02:07 +02:00
public function get_userlevel($uid)
{
$sql = "SELECT userlevel FROM users WHERE id=$uid";
$q = $this->db->query($sql);
2021-10-30 19:02:07 +02:00
$res = $q->row_array();
return $res['userlevel'];
}
2021-10-30 19:02:07 +02:00
public function get_username($uid)
{
$sql = "SELECT username FROM users WHERE id=$uid";
2021-10-30 19:02:07 +02:00
$q = $this->db->query($sql);
2021-10-30 19:02:07 +02:00
$res = $q->row_array();
2021-10-30 19:02:07 +02:00
return $res['username'];
}
2021-10-30 19:02:07 +02:00
public function get_userdata($id)
{
$sql = "SELECT * FROM users WHERE id='$id'";
$q = $this->db->query($sql);
2021-10-30 19:02:07 +02:00
return $q->row_array();
}
2021-10-30 19:02:07 +02:00
public function get_villageid($userid)
{
$sql = "SELECT id FROM villages WHERE userid='$userid' AND selected='1'";
$q = $this->db->query($sql);
$res = $q->row_array();
2021-10-30 19:02:07 +02:00
return $res['id'];
}
2021-10-30 19:02:07 +02:00
public function get_village_data($uid)
{
$sql = "SELECT * FROM villages WHERE userid='$uid' AND selected='1'";
$q = $this->db->query($sql);
return $q->row_array();
}
2021-10-30 19:02:07 +02:00
}
//nowhitesp