Exemple #1
0
 function load()
 {
     if ($this->code) {
         $res = db_query("SELECT * FROM coursedefns WHERE STRCMP(code,'%s')=0", $this->code);
     } else {
         if ($this->id) {
             $res = db_query("SELECT * FROM coursedefns WHERE id='%d'", $this->id);
         } else {
             if ($this->title) {
                 $res = db_query("SELECT * FROM coursedefns WHERE STRCMP(title,'%s')=0", $this->title);
             } else {
                 Error::generate('debug', 'Not enough information to find course in CourseDefn::load().');
                 return false;
             }
         }
     }
     if (!$res) {
         Error::generate('debug', 'CourseDefn->load: $res is null');
         return false;
     }
     $ret = db_get_assoc($res);
     if (!$ret) {
         Error::generate('debug', 'CourseDefn->load: $ret is null');
         return false;
     }
     $this->title = $ret['title'];
     $this->code = $ret['code'];
     $this->id = $ret['id'];
     $this->descr = $ret['descr'];
     $this->cid = $ret['cid'];
     $this->university = $ret['university'];
     return $this;
 }
function biz_getConfig()
{
    $sql = "SELECT name, value FROM biz_admin_config";
    return db_get_assoc($sql);
}
Exemple #3
0
 public static function Get($id)
 {
     $res = db_query("\tSELECT *\n\t\t\t\t\t\tFROM resourcereports\n\t\t\t\t\t\tWHERE id='%d'\n\t\t\t\t\t\tLIMIT 1", $id);
     return db_get_assoc($res);
 }
Exemple #4
0
 protected static function get_with_id($name)
 {
     $res = db_query("SELECT * FROM %ss WHERE id='%s'", static::subGetClass(), $name);
     if (!$res || !($ret = db_get_assoc($res))) {
         Error::generate('debug', 'Could not query database in get_with_id');
         return false;
     } else {
         return $ret;
     }
 }
Exemple #5
0
function do_review_review_add_category_disp()
{
    $sql = 'SELECT c_review_category_id, category_disp FROM c_review_category';
    return db_get_assoc($sql);
}
Exemple #6
0
/**
 * スキン画像のfilenameを取得
 */
function db_get_c_skin_filename_list()
{
    $sql = 'SELECT skinname, filename FROM c_skin_filename';
    return db_get_assoc($sql);
}
Exemple #7
0
    protected static function eav_create($subject, $parent)
    {
        $res = db_query('SELECT id, lft, rgt
				FROM	comments
				WHERE	id=\'%d\'', $parent);
        if ($res) {
            $parent = db_get_assoc($res);
        } else {
            Error::generate('warn', 'Invalid parent for comment.');
            return;
        }
        $res = db_query("UPDATE comments SET rgt = rgt + 2 WHERE rgt > '%d'", $parent['lft']);
        $res = db_query("UPDATE comments SET lft = lft + 2 WHERE lft > '%d'", $parent['lft']);
        $res = db_query('INSERT
				INTO %ss	(subject, lft, rgt)
				VALUES		(\'%s\', \'%d\', \'%d\')', static::subGetClass(), $subject, $parent['lft'] + 1, $parent['lft'] + 2);
        if ($res) {
            return mysql_insert_id();
        } else {
            Error::generate('notice', static::subGetClass() . 'name already taken.');
            return false;
        }
    }
Exemple #8
0
function db_admin_c_admin_config_all()
{
    $sql = 'SELECT name, value FROM c_admin_config';
    return db_get_assoc($sql);
}
Exemple #9
0
/**
 * コミュニティ参加要請状況をコミュニティIDから取得
 *
 * @param  int $c_commu_id
 * @return array コミュニティ参加要請状況
 */
function db_commu_c_commu_member_confirm4c_commu_id($c_commu_id)
{
    $sql = 'SELECT c_commu_member_confirm_id, c_member_id FROM c_commu_member_confirm' . ' WHERE c_commu_id = ?';
    $params = array(intval($c_commu_id));
    $c_commu_member_confirm = db_get_assoc($sql, $params, 'main');
    return $c_commu_member_confirm;
}
Exemple #10
0
/**
 * c_member_configの値を取得する
 *
 * @param int $c_member_id
 * @return array メンバー設定情報
 */
function db_member_c_member_config4c_member_id($c_member_id)
{
    $sql = 'SELECT name, value FROM c_member_config WHERE c_member_id = ?';
    $params = array(intval($c_member_id));
    $member_config = db_get_assoc($sql, $params);
    return $member_config;
}