ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 6396


Ignore:
Timestamp:
Apr 7, 2008, 11:36:42 PM (14 years ago)
Author:
toraneko
Message:

#2180 共通処理関数追加

File:
1 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/work/toraneko/prj_commentmail/webapp/lib/db/member.php

    r6393 r6396  
    19741974}
    19751975
     1976/*
     1977 * 設定値があるか
     1978 * @param int $c_member_id
     1979 * @param int $c_member_config_option_id
     1980 * @return true あり false なし
     1981 */
     1982function db_member_c_member_config4optionid($c_member_id,$c_member_config_option_id)
     1983{
     1984    $sql = 'SELECT COUNT(c_member_config_id) FROM c_member_config'
     1985         . ' WHERE c_member_id = ? AND c_member_config_option_id = ?';
     1986    $params = array(intval($c_member_id),intval($c_member_config_option_id));
     1987    return (bool)db_get_one($sql, $params, 'main');
     1988}
     1989
     1990/*
     1991 * c_member_config_option_id取得
     1992 * @param str $name
     1993 * @return int $c_member_config_option_id
     1994 */
     1995function db_member_config_option_id4name($name)
     1996{
     1997    $sql = 'SELECT c_member_config_option_id FROM c_member_config_option'
     1998         . ' WHERE name = ?';
     1999    $params = array(strval($name));
     2000    return db_get_one($sql,$params);   
     2001}
     2002
     2003/*
     2004 * c_member_config更新(無ければInsert)
     2005 * @param int $c_member_id
     2006 * @param str $name
     2007 * @param str $value
     2008 */
     2009function db_member_update_c_member_config($c_member_id, $name, $value)
     2010{
     2011    $optionid = db_member_config_option_id4name($name);
     2012
     2013    if (!db_member_c_member_config4optionid($c_member_id,$optionid)){
     2014        $data = array('c_member_id' => intval($c_member_id),
     2015                  'c_member_config_option_id' => intval($optionid),
     2016                  'value' => intval($value));
     2017        db_insert('c_member_config', $data);
     2018    } else {
     2019        $data = array('value' => intval($value));
     2020        $where = array('c_member_id'=>intval($c_member_id),
     2021                       'c_member_config_option_id' => intval($optionid));
     2022        db_update('c_member_config', $data, $where);
     2023    }
     2024}
     2025
    19762026?>
Note: See TracChangeset for help on using the changeset viewer.