当前位置: 首页>>代码示例>>PHP>>正文


PHP aql::update方法代码示例

本文整理汇总了PHP中aql::update方法的典型用法代码示例。如果您正苦于以下问题:PHP aql::update方法的具体用法?PHP aql::update怎么用?PHP aql::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在aql的用法示例。


在下文中一共展示了aql::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: foreach

        #saving data in the database
        $aql = "blog_article {\n            \t\t\t\t\tblog_id,\n\t\t\t\t\t\t\t\tauthor__person_id,\n\t\t\t\t\t\t\t\ttitle,\n\t\t\t\t\t\t\t\tcontent as article_content,\n\t\t\t\t\t\t\t\tblog_category_id,\n\t\t\t\t\t\t\t\tstatus,\n\t\t\t\t\t\t\t\tactive,\n\t\t\t\t\t\t\t\tmarket_id,\n\t\t\t\t\t\t\t\tintroduction,\n\t\t\t\t\t\t\t\tfeatured,\n\t\t\t\t\t\t\t\tmedia_item_id\n\t\t\t\t\t\t\t\t{$condition}\n\t\t\t\t\t\t\t\torder by blog_article_id DESC\n           \t\t\t\t\t}";
        aql::save();
        $rs_article = aql::select($aql);
        if (count($_SESSION['blog_article']['tags'])) {
            foreach ($_SESSION['blog_article']['tags'] as $tag_session_array_id) {
                $blog_article_id = $article_id;
                $blog_tag_id = $tag_session_array_id;
                #search this combination in database
                $aql_article_tag = "blog_article_tag{\n\t\t\t\t\t\t\t\t*\n\t\t\t\t\t\t\t\twhere blog_article_tag.blog_article_id = '{$blog_article_id}' and blog_article_tag.blog_tag_id = '{$blog_tag_id}'\n\t\t\t\t\t\t\t}";
                $rs_article_tag = aql::select($aql_article_tag);
                if (count($rs_article_tag) > 0) {
                    $blog_article_tag_id = $rs_article_tag[0]['blog_article_tag_id'];
                    $table_name = 'blog_article_tag';
                    $data_array = array('active' => 0);
                    aql::update($table_name, $data_array, $blog_article_tag_id);
                }
            }
            foreach ($_SESSION['blog_article']['tags'] as $tag_session_array_id) {
                #inserting each
                $table_name = 'blog_article_tag';
                $data_array = array('blog_article_id' => $article_id, 'blog_tag_id' => $tag_session_array_id);
                $rs = aql::insert($table_name, $data_array);
            }
        }
    }
}
#get the blog name
if (trim($rs_article[0]['blog_id']) != '') {
    $blog_id = trim($rs_article[0]['blog_id']);
    $aql_blog = "blog {\n\t\t\t\t\t\t\t\t\t\t\tname,\n\t\t\t\t\t\t\t\t\t\t\tslug\n\t\t\t\t\t\t\t\t\t\t\twhere blog.id  ='{$blog_id}'\n\t\t\t\t\t\t\t\t\t\t\t}";
开发者ID:hshoghi,项目名称:cms,代码行数:31,代码来源:preview.php

示例2: decrypt

<?php

$blog_author_ide = $_POST['blog_author_ide'];
$blog_author_id = decrypt($blog_author_ide, 'blog_author');
$aql = "\nmarket {\n   name as market_name\n   where market.primary = 1\n   order by name asc\n}";
$markets = aql::select($aql);
$new_market_ids = array();
foreach ($markets as $market) {
    if ($_POST['market_' . $market['market_ide']]) {
        $new_market_ids[] = $market['market_id'];
    }
}
$where = 'market_id not in (' . implode(',', $new_market_ids) . ')';
$aql = "\nblog_author_market{\n   market_id\n   where blog_author_id={$blog_author_id} and active=1\n}";
//'bam' short for 'blog_author_market'
$all_bam = aql::select($aql);
if (is_array($all_bam)) {
    foreach ($all_bam as $bam) {
        if (!in_array($bam['market_id'], $new_market_ids)) {
            aql::update('blog_author_market', array('active' => 0), $bam['blog_author_market_id']);
        } else {
            unset($new_market_ids[array_search($bam['market_id'], $new_market_ids)]);
        }
    }
}
foreach ($new_market_ids as $new_market_id) {
    aql::insert('blog_author_market', array('market_id' => $new_market_id, 'blog_author_id' => $blog_author_id));
}
开发者ID:hshoghi,项目名称:cms,代码行数:28,代码来源:add_staff.php

示例3: array

                aql::insert('website_uri_data', $data);
            }
        }
    }
    aql::update('website_page', array('url_specific' => $_POST['val']), $_POST['website_page_id']);
    //sql("update website_uri_data set on_website = 1 where uri = '".$_POST['uri']."' and website_id = ".$website_id);
    $aql = "website_uri_data { where uri = '" . $_POST['uri'] . "' and website_id = " . $website_id . "}";
    $rs = aql::select($aql);
    if ($rs) {
        foreach ($rs as $r) {
            $website_uri_data = array('on_website' => '1');
            $rs = aql::update('website_uri_data', $website_uri_data, $r['website_uri_data_id']);
        }
    }
    ?>
		<input type="hidden" id="uri_enabled" value="<?php 
    echo $_POST['uri'];
    ?>
" />
<?php 
} else {
    //$update = sql("update website_uri_data set on_website = 0 where uri = '".$_POST['uri']."' and website_id = ".$website_id);
    $aql = "website_uri_data { where uri = '" . $_POST['uri'] . "' and website_id = " . $website_id . "}";
    $rs = aql::select($aql);
    if ($rs) {
        foreach ($rs as $r) {
            $website_uri_data = array('on_website' => '0');
            $rs = aql::update('website_uri_data', $website_uri_data, $r['website_uri_data_id']);
        }
    }
}
开发者ID:hshoghi,项目名称:cms,代码行数:31,代码来源:set_url_specific.php

示例4: saveArray

 /**
  * aql::insert/update on the save array depending on what needs to be done
  * recursive because of sub objects / queries
  * @param   array   $save_array     array to save
  * @param   array   $ids            ids to pass through
  * @return  array                   updated save array
  */
 private final function saveArray($save_array, $ids = array())
 {
     $is_dev = $this->isDev();
     // copy out objects
     $objects = $save_array['__objects__'];
     unset($save_array['__objects__']);
     // helper function
     $addRecordInfo = function ($table_block, $is_update = false) {
         $fields = array('update' => array('mod__person_id', 'update__person_id'), 'insert' => array('insert__person_id'));
         $key = $is_update ? 'update' : 'insert';
         $time_field = $key . '_time';
         if (!$table_block['fields'][$time_field]) {
             $table_block['fields'][$time_field] = aql::now();
         }
         if (!defined('PERSON_ID') || !is_numeric(PERSON_ID)) {
             return $table_block;
         }
         $id = PERSON_ID;
         $fields = $fields[$key];
         foreach ($fields as $field) {
             $table_block['fields'][$field] = $table_block['fields'][$field] ?: $id;
         }
         return $table_block;
     };
     foreach ($save_array as $table => $info) {
         // make sure this is an array
         $info['fields'] = arrayify($info['fields']);
         foreach ($ids as $n => $v) {
             if (is_array($this->_ignore['fields']) && in_array($n, $this->_ignore['fields'])) {
                 // since ids are added to each table in case of foreign keys
                 // abort if they are being ignored in this model
                 continue;
             }
             // add the id to the table block iff there are already fields
             if ($info['fields'] && !$info['fields'][$n]) {
                 $save_array[$table]['fields'][$n] = $v;
                 $info['fields'][$n] = $v;
             }
         }
         if ($info['fields']) {
             $is_update = $info['id'] && is_numeric($info['id']);
             $info = $addRecordInfo($info, $is_update);
             if ($is_update) {
                 aql::update($table, $info['fields'], $info['id'], true);
             } else {
                 $rs = aql::insert($table, $info['fields'], true);
                 $save_array[$table]['id'] = $info['id'] = $rs[0][$table . '_id'];
             }
         }
         $ids[$table . '_id'] = $info['id'];
         if (is_array($info['subs'])) {
             foreach ($info['subs'] as $i => $sub) {
                 $save_array[$table]['subs'][$i] = $this->saveArray($sub, $ids);
             }
         }
     }
     if (is_array($objects)) {
         foreach ($objects as $o) {
             if (!$o['data']) {
                 continue;
             }
             $tmp = Model::get($o['object']);
             $tmp->_data = $o['data'];
             $tmp->loadIDs($ids);
             $pt = $tmp->getPrimaryTable();
             $pt_id = $pt . '_id';
             if (!$tmp->{$pt_id} && $this->{$pt_id}) {
                 $tmp->{$pt_id} = $this->{$pt_id};
             }
             $tmp->save(true);
             if ($tmp->_errors) {
                 $this->addErrors($tmp->_errors);
                 $this->failTransaction();
             }
         }
     }
     $save_array['objects'] = $objects;
     return $save_array;
 }
开发者ID:HotwireCommunications,项目名称:skyphp,代码行数:86,代码来源:class.Model.php

示例5:

<?php

$field = $_POST['field'];
$value = $_POST['value'];
if (!$value) {
    $value = '';
}
$data[$field] = $value;
aql::update('website_page_data', $data, $_POST['sky_ide']);
?>
<a class="changeable" ide="<?php 
echo $_POST['sky_ide'];
?>
" field="<?php 
echo $_POST['field'];
?>
"><?php 
echo $_POST['value'] ? $_POST['value'] : '_________________';
?>
</a>
开发者ID:hshoghi,项目名称:cms,代码行数:20,代码来源:update-record.php

示例6: login_person

function login_person($person, $remember_me)
{
    global $cookie_domain;
    $_SESSION['login']['person_id'] = $person['person_id'];
    $_SESSION['login']['person_ide'] = encrypt($person['person_id'], 'person');
    $_SESSION['login']['fname'] = $person['fname'];
    $_SESSION['login']['lname'] = $person['lname'];
    $_SESSION['login']['email'] = $person['email_address'];
    @setcookie('username', $person['username'], time() + 5184000, '/', $cookie_domain);
    if ($remember_me) {
        @setcookie('password', encrypt($person['password']), time() + 5184000, '/', $cookie_domain);
    }
    // log this login
    aql::update('person', array('last_login_time' => 'now()'), $person['person_id']);
}
开发者ID:HotwireCommunications,项目名称:skyphp,代码行数:15,代码来源:functions.inc.php

示例7: updateDBRecord

 /**
  * @param  int $id
  */
 public function updateDBRecord($id)
 {
     // split db_field
     $dot = strpos($this->params['db_field'], '.');
     $table = substr($this->params['db_field'], 0, $dot);
     $field = substr($this->params['db_field'], $dot + 1);
     if (!$table || !$field) {
         $this->errors[] = 'There was an error updating the record for this item.
             Please contact your system administrator.';
         return;
     }
     \aql::update($table, array($field => $id), $this->params['db_row_id']);
 }
开发者ID:hshoghi,项目名称:cms,代码行数:16,代码来源:UploadHandler.php

示例8: array

<?php

$data = array($_POST['field'] => $_POST['value'], 'mod__person_id' => PERSON_ID);
$update = aql::update('website_page', $data, $_POST['website_page_ide']);
if ($update == true && $_POST['field'] == 'page_type') {
    exit('success');
} else {
    if ($update == true && $_POST['field'] == 'nickname') {
        ?>
		<a id="name_change" title="Click to Change <?php 
        echo ucwords(str_replace('_', '', $_POST['field']));
        ?>
"><?php 
        echo $_POST['value'];
        ?>
</a>
<?php 
    } else {
        print_a($update);
    }
}
开发者ID:hshoghi,项目名称:cms,代码行数:21,代码来源:change_field.php

示例9: exit

<?php

if ($_POST['func'] == 'updateValue') {
    $table = $_POST['table'];
    if (!$table) {
        exit("Please enter a table name.");
    }
    $column = $_POST['column'];
    if (!$table) {
        exit("Please enter a column name.");
    }
    $id = $_POST['id'];
    if (!$table) {
        exit("Please enter an id name.");
    }
    $newVal = $_POST['newVal'];
    if (!$newVal) {
        $newVal = NULL;
    }
    aql::update($table, array($column => $newVal), $id);
    exit("success");
}
开发者ID:hshoghi,项目名称:cms,代码行数:22,代码来源:ajax.php

示例10: array

<?php

$tab = $tab ? $tab : $_POST['tab'];
if (!$media_upload['vfolder_path']) {
    $media_upload['vfolder_path'] = $_POST['vfolder'];
}
$blog_article_ide = IDE ? IDE : $_POST['blog_article_ide'];
$vfolder = $vfolder ? $vfolder : media::get_vfolder($media_upload['vfolder_path']);
if (is_array($vfolder['items'])) {
    //check if there is a default image. If there is not, set one for blog_article.media_item_id
    if (!$blog_article) {
        $blog_article = aql::profile('blog_article', $blog_article);
    }
    if (!$blog_article['media_item_id']) {
        $fields = array('media_item_id' => $vfolder['items'][0]['media_item_id']);
        aql::update('blog_article', $fields, $blog_article_ide);
        #echo $vfolder['items'][0]['media_item_id'];
        $blog_article['media_item_id'] = $vfolder['items'][0]['media_item_id'];
        $blog_article['media_item_ide'] = $vfolder['items'][0]['media_item_ide'];
    }
    //go through each image in this blog's folder
    foreach ($vfolder['items'] as $item) {
        $img = media::get_item($item['id'], 100, 100, 0);
        if ($tab == 'mp3') {
            include 'pages/admin/blog/post/ajax/mp3-item.php';
        } else {
            include 'item.php';
        }
    }
    //foreach
} else {
开发者ID:hshoghi,项目名称:cms,代码行数:31,代码来源:items.php

示例11: array

<?php

$update = aql::update('website_page', array($_POST['field'] => $_POST['value']), $_POST['website_page_ide']);
if ($update == true) {
    ?>
		<a title="Change <?php 
    echo ucwords(str_replace('_', ' ', $_POST['field']));
    ?>
" id="<?php 
    echo $_POST['field'];
    ?>
_change" page_ide="<?php 
    echo $_POST['website_page_ide'];
    ?>
" field="<?php 
    echo $_POST['field'];
    ?>
" style="cursor:pointer"><?php 
    echo $_POST['value'];
    ?>
</a>
<?php 
}
开发者ID:hshoghi,项目名称:cms,代码行数:23,代码来源:change_field.php

示例12: array

                #inserting each
                $table_name = 'blog_article_tag';
                $data_array = array('blog_article_id' => $article_id, 'blog_tag_id' => $tag_session_array_id);
                $rs = aql::insert($table_name, $data_array);
            }
        }
    }
}
// tweet if new posting in applicable market
$age = floor(time() - strtotime($rs_article[0]['post_time'])) / (60 * 60 * 24);
if ($rs_article[0]['status'] == 'A' && $age < 2 && !$rs_article[0]['tweet_sent'] && $rs_article[0]['market_id']) {
    $aql = "market {\n\t\t\t\t\t\t\tslug as market_slug,\n\t\t\t\t\t\t\ttwitter_username,\n\t\t\t\t\t\t\ttwitter_password\n\t\t\t\t\t\t\twhere id = {$rs_article[0]['market_id']}\n\t\t\t\t\t\t}";
    $rs = aql::select($aql);
    $market = $rs[0];
    $arr = array('tweet_sent' => 'now()');
    aql::update('blog_article', $arr, $rs_article[0]['blog_article_id']);
    if ($market['twitter_username']) {
        //tweet
        include 'lib/class/class.twitter.php';
        $t = new Twitter($market['twitter_username'], $market['twitter_password']);
        $aql = "blog {\n\t\t\t\t\t\t\t\tname as blog_name,\n\t\t\t\t\t\t\t\tslug as blog_slug\n\t\t\t\t\t\t\t\twhere id = {$rs_article[0]['blog_id']}\n\t\t\t\t\t\t\t}";
        $rs = aql::select($aql);
        $blog = $rs[0];
        $url = 'http://' . $market['market_slug'] . '.joonbug.com/' . $blog['blog_slug'] . '/' . $rs_article[0]['blog_article_ide'];
        $tiny_domain = 'joonb.ug';
        $tinyurl = uize($url, $tiny_domain);
        $status_msg = "[{$blog['blog_name']}] {$rs_article[0]['title']}, {$rs_article[0]['introduction']}";
        $status_msg = substr($status_msg, 0, 100);
        $status_msg .= " {$tinyurl}";
        $t->updateStatus($status_msg);
        echo 'Posted to twitter.com/' . $market['twitter_username'] . '<br />';
开发者ID:hshoghi,项目名称:cms,代码行数:31,代码来源:save.php

示例13: array

<?php

$article_ide = $_POST['blog_article_id'];
$person_id = $_SESSION['login']['person_id'];
$table_name = "blog_article";
$data_array = array('active' => 0, 'mod_time' => 'now()', 'mod__person_id' => $person_id);
aql::update($table_name, $data_array, $article_ide);
header("Location:/admin/blog/article/list/");
exit;
开发者ID:hshoghi,项目名称:cms,代码行数:9,代码来源:delete.php

示例14: array

<?php

$rs = aql::select("website_page_data { value where website_page_ide = '{$_POST['website_page_ide']}' and field = '{$_POST['field']}' }");
$data = array('value' => $_POST['value'], 'mod__person_id' => PERSON_ID, 'update_time' => 'now()');
if (is_numeric($rs[0]['website_page_data_id'])) {
    $update = aql::update('website_page_data', $data, $rs[0]['website_page_data_ide']);
    if ($update == true) {
        echo 'saved';
    } else {
        echo 'error';
    }
} else {
    $data['website_page_id'] = decrypt($_POST['website_page_ide'], 'website_page');
    $data['field'] = $_POST['field'];
    $insert = aql::insert('website_page_data', $data);
    if (is_numeric($insert['website_page_data_id'])) {
        echo 'saved';
    } else {
        echo 'error';
    }
}
开发者ID:hshoghi,项目名称:cms,代码行数:21,代码来源:change_data.php

示例15: array

<?php

$rs = aql::select("website_uri_data { value where website_id = {$_POST['website_id']} and uri = '{$_POST['uri']}' and field = '{$_POST['field']}' }");
if ($rs) {
    aql::update("website_uri_data", array('on_website' => $_POST['url_specific']), $rs[0]['website_uri_data_id']);
}
if (!$_POST['url_specific']) {
    $rs = aql::select("website_page_data { value where field = '{$_POST['field']}' and website_page_id = {$_POST['website_page_id']} }");
}
exit($rs[0]['value']);
开发者ID:hshoghi,项目名称:cms,代码行数:10,代码来源:show-input-data.php


注:本文中的aql::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。