本文整理汇总了PHP中db_row函数的典型用法代码示例。如果您正苦于以下问题:PHP db_row函数的具体用法?PHP db_row怎么用?PHP db_row使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_row函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WT_GetProblem
function WT_GetProblem()
{
global $lid;
if (!WT_IPC_CheckLogin()) {
return;
}
if ($lid == '') {
return;
}
$q = db_select('tester_problems', array('*'), '(`uploaded`=FALSE) AND (`lid`=' . $lid . ')', 'ORDER BY `id` LIMIT 1');
if (db_affected() <= 0) {
return;
}
$r = db_row($q);
$s = unserialize($r['settings']);
$arr = array();
$arr['ID'] = $r['id'];
if (isset($s['filename'])) {
$arr['FILENAME'] = $s['filename'];
}
if (preg_match('/[0-9]+/', $s['checker'])) {
$arr['CHECKER'] = $s['checker'];
}
print db_pack($arr);
}
示例2: InitInstance
function InitInstance($id = -1, $virtual = false)
{
$this->id = $id;
$this->_virtual = $virtual;
$q = db_select('service', array('*'), "`id` = {$id}");
if (db_affected() <= 0) {
$this->id = 0;
} else {
$r = db_row($q);
$this->UnserializeSettings($r['settings']);
}
if (!$virtual) {
content_url_var_push_global('action');
content_url_var_push_global('id');
editor_add_function('Управление сервисом', 'Editor_RSSManage');
editor_add_function('Разделы', 'Editor_ContentManage');
}
if ($this->id > 0) {
// Id>0 so the service has been created
$url = content_url_get_full();
if (preg_match('/^' . prepare_pattern(config_get('document-root')) . '[(\\/)|(\\/index.php)]?(\\?(.*))?$/si', $url)) {
global $CORE;
$CORE->PAGE->SetRSS($this->settings['title'], config_get('http-document-root') . '/rss.php');
}
}
}
示例3: WT_GetTaskList
function WT_GetTaskList()
{
if (!WT_IPC_CheckLogin()) {
return;
}
$q = db_query('SELECT `ts`.`id`, `ts`.`lid` ' . 'FROM `tester_solutions` AS `ts`, ' . '`tester_problems` AS `tp` ' . 'WHERE (`ts`.`status`=0) AND ' . '(`ts`.`problem_id`=`tp`.`id`) AND ' . '(`tp`.`uploaded`=2) ORDER BY `timestamp` LIMIT 15');
while ($r = db_row($q)) {
println($r['id'] . '@' . $r['lid']);
}
}
示例4: WT_on_user_delete
function WT_on_user_delete($user_id)
{
/* util.php is not included set, so we need this stupid code here */
global $XPFS;
$q = db_select('tester_solutions', array('id'), "`user_id`={$user_id}");
while ($r = db_row($q)) {
$XPFS->removeItem('/tester/testing/' . $r['id']);
}
db_delete('tester_solutions', "`user_id`={$user_id}");
}
示例5: InitFields
function InitFields()
{
$q = db_select('dataset_assoc', array('id'), '`dataset`=' . $this->id, 'ORDER BY `order`');
$this->fields = array();
while ($r = db_row($q)) {
$c = new CDataField();
$c->Init($r['id']);
$c->UpdateDataSettings($this->settings['fields'][$c->GetField()]);
$this->fields[] = $c;
}
}
示例6: _mysql_field_exists
function _mysql_field_exists($table, $field)
{
# $table = table_by_key($table); # _mysql_field_exists is always called with the expanded table name - don't expand it twice
$sql = "SHOW COLUMNS FROM {$table} LIKE '{$field}'";
$r = db_query($sql);
$row = db_row($r['result']);
if ($row) {
return true;
}
return false;
}
示例7: WT_GetChecker
function WT_GetChecker()
{
if (!WT_IPC_CheckLogin()) {
return;
}
$r = db_row(db_select('tester_checkers', array('*'), '`uploaded`=FALSE', 'LIMIT 1'));
if ($r) {
$s = unserialize($r['settings']);
$arr = array('ID' => $r['id'], 'SRC' => $s['src'], 'COMPILERID' => $s['compiler_id']);
print db_pack($arr);
}
}
示例8: one_by_icode
public function one_by_icode($icode, $is_force = false)
{
$cache_key = $this->CACHE_PREFIX . $this->table_name . '*' . $icode;
if (!$is_force) {
$row = FwCache::get_value($cache_key);
}
if ($is_force || is_null($row)) {
$row = db_row($this->table_name, array('icode' => $icode));
FwCache::set_value($cache_key, $row);
}
return $row;
}
示例9: update_att_links
public function update_att_links($table_name, $id, $form_att)
{
if (!is_array($form_att)) {
return;
}
$me_id = Utils::me();
#1. set status=1 (under update)
$fields = array();
$fields['status'] = 1;
$where = array();
$where['table_name'] = $table_name;
$where['item_id'] = $id;
db_update($this->att_table_link, $fields, $where);
#2. add new items or update old to status =0
foreach ($form_att as $att_id => $value) {
$att_id += 0;
if (!$att_id) {
continue;
}
$where = array();
$where['table_name'] = $table_name;
$where['item_id'] = $id;
$where['att_id'] = $att_id;
$row = db_row($att_table_link, $where);
if (count($row)) {
#existing link
$fields = array();
$fields['status'] = 0;
$where = array();
$where['id'] = $row['id'];
db_update($att_table_link, $fields, $where);
} else {
#new link
$fields = array();
$fields['att_id'] = $att_id;
$fields['table_name'] = $table_name;
$fields['item_id'] = $id;
$fields['add_user_id'] = $me_id;
db_insert($att_table_link, $fields);
}
}
#3. remove not updated atts (i.e. user removed them)
$where = array();
$where['table_name'] = $table_name;
$where['item_id'] = $id;
$where['status'] = 1;
db_del($att_table_link, $where);
}
示例10: Init
function Init($id)
{
if (($q = db_select('datatypes', array('*'), "`id`={$id}")) && db_affected() > 0) {
$this->id = $id;
} else {
$this->id = -1;
}
if ($this->id > 0) {
$r = db_row($q);
$this->name = $r['name'];
$this->UnserializeSettings($r['settings']);
$this->data = new $r['class']();
$this->data->Init();
$this->data->UnSerializeSettings($this->settings['data']);
}
}
示例11: Init
function Init($id)
{
if ($q = db_select('dataset_assoc', array('*'), "`id`={$id}")) {
$this->id = $id;
} else {
$this->id = -1;
}
if ($this->id > 0) {
$r = db_row($q);
$this->datatype = new CDataType();
$this->datatype->Init($r['datatype']);
$this->title = $r['title'];
$this->field = $r['field'];
$this->UnserializeSettings($r['settings']);
$this->datatype->UpdateSettings($this->settings);
}
}
示例12: i18n_setLanguage
function i18n_setLanguage($lang)
{
global $common_language;
if ($lang == 'C') {
setcookie('synchrotronLanguage', '', 0, $auth_path);
unset($GLOBALS['common_language']);
unset($common_language);
unset($_COOKIE['synchrotronLanguage']);
return;
}
$db = db_connection();
sql_addToWhereClause($where, 'WHERE', 'code', '=', $lang);
$query = db_query($db, "select id from languages {$where};");
if (db_numRows($query) > 0) {
list($common_language) = db_row($query, 0);
$common_language = intval($common_language);
}
}
示例13: Init
function Init($id = -1, $class = '', $virtual = false)
{
$this->service = null;
$this->_virtual = $virtual;
if ($q = db_select('service', array('*'), "`id`={$id}")) {
$this->id = $id;
} else {
$this->id = -1;
}
if ($id == -1) {
$this->SetClassName($class);
$this->SpawnService();
} else {
$r = db_row($q);
$this->SetClassName($r['sclass']);
$this->SetName($r['name']);
$this->SpawnService();
$this->service->UnserializeSettings($r['settings']);
}
$this->id = $id;
}
示例14: WT_GetTask
function WT_GetTask()
{
global $id, $lid;
if (!WT_IPC_CheckLogin()) {
return;
}
if (!isset($id) || !isset($lid)) {
print 'Void filename for WT_GetTask()';
return;
}
$solution = db_row(db_select('tester_solutions', array('*'), "`id`={$id}"));
if ($solution['id'] == '') {
return;
}
$contest = db_row(db_select('tester_contests', array('*'), '`id`=' . $solution['contest_id'] . ' AND `lid`=' . $lid));
$problem = db_row(db_select('tester_problems', array('*'), '`id`=' . $solution['problem_id'] . ' AND `lid`=' . $lid));
$contest['settings'] = unserialize($contest['settings']);
$solution['parameters'] = unserialize($solution['parameters']);
$arr = array();
// Solution's based settings
$arr['PROBLEMID'] = $solution['problem_id'];
$arr['COMPILERID'] = $solution['parameters']['compiler_id'];
$arr['SOURCE'] = $solution['parameters']['src'];
if ($contest['settings']['rules'] == 0) {
$arr['ACM'] = 'TRUE';
} else {
$arr['ACM'] = 'FALSE';
}
// Problem's passed settings
$prpars = unserialize($problem['settings']);
$arr['TIMELIMIT'] = $prpars['timelimit'];
$arr['MEMORYLIMIT'] = $prpars['memorylimit'];
$arr['INPUTFILE'] = $prpars['input'];
$arr['OUTPUTFILE'] = $prpars['output'];
$arr['TESTS'] = $prpars['tests'];
$arr['BONUS'] = $prpars['bonus'];
print db_pack($arr);
}
示例15: pacrypt
function pacrypt($pw, $pw_db = "")
{
$ci =& get_instance();
$pw = stripslashes($pw);
$password = "";
$salt = "";
if ($ci->config->item('encrypt') == 'md5crypt') {
$split_salt = preg_split('/\\$/', $pw_db);
if (isset($split_salt[2])) {
$salt = $split_salt[2];
}
$password = md5crypt($pw, $salt);
} elseif ($ci->config->item('encrypt') == 'md5') {
$password = md5($pw);
} elseif ($ci->config->item('encrypt') == 'system') {
if ($pw_db) {
$password = crypt($pw, $pw_db);
} else {
$password = crypt($pw);
}
} elseif ($ci->config->item('encrypt') == 'cleartext') {
$password = $pw;
} elseif ($ci->config->item('encrypt') == 'mysql_encrypt') {
$pw = escape_string($pw);
if ($pw_db != "") {
$salt = escape_string(substr($pw_db, 0, 2));
$res = db_query("SELECT ENCRYPT('" . $pw . "','" . $salt . "');");
} else {
$res = db_query("SELECT ENCRYPT('" . $pw . "');");
}
$l = db_row($res["result"]);
$password = $l[0];
} else {
show_error('unknown/invalid encrypt settings for pacrypt setting: ' . $ci->config->item("encrypt"));
}
return $password;
}