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


PHP delete_data函数代码示例

本文整理汇总了PHP中delete_data函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_data函数的具体用法?PHP delete_data怎么用?PHP delete_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: del

 function del()
 {
     $ids = I('ids');
     if (is_array($ids)) {
         $map['id'] = array('in', $ids);
         $result = delete_data($this->table, $map);
         $ids = implode(',', $ids);
         if ($result) {
             //action_log($this->table,$ids);
             $this->success('操作成功', U('index'));
         } else {
             $this->error($result);
         }
     } else {
         $ids = intval($ids);
         $map['id'] = $ids;
         $result = delete_data($this->table, $map);
         if ($result) {
             //action_log($this->table,$ids);
             $this->success('操作成功', U('index'));
         } else {
             $this->error($result);
         }
     }
 }
开发者ID:976112643,项目名称:manor,代码行数:25,代码来源:ActionLogController.class.php

示例2: praise_get

 public function praise_get()
 {
     $this->check_token();
     $table = 'praise';
     $table_name = 'information';
     $catid = I('get.id', 0, 'intval');
     $uid = $this->uid;
     // 27192;
     // 检测此赞是否存在
     $map = array('table_name' => $table_name, 'member_id' => $uid, 'catid' => $catid);
     $res = get_info($table, $map);
     if ($res) {
         // 取消赞
         $result = delete_data($table, array('id' => $res['id']));
         if ($result) {
             // 更新赞的数量
             update_num($table_name, array('id' => $catid), 'praise_num', 1, false);
             $msg = array('praise_status' => 2, 'msg' => '取消成功');
         } else {
             $this->error(1500);
         }
     } else {
         // 添加赞
         $_POST = array('table_name' => $table_name, 'member_id' => $uid, 'catid' => $catid);
         $result = update_data($table);
         if ($result) {
             // 更新赞的数量
             update_num($table_name, array('id' => $catid), 'praise_num', 1, true);
             $msg = array('praise_status' => 1, 'msg' => '添加成功');
         } else {
             $this->error(1500);
         }
     }
     $this->success($msg);
 }
开发者ID:jkzleond,项目名称:alhelp_api,代码行数:35,代码来源:InformationController.class.php

示例3: testCanDeleteData

 public function testCanDeleteData()
 {
     _elgg_services()->db->addQuerySpec(['sql' => 'DELETE FROM A WHERE b = :b', 'params' => [':b' => 'b'], 'row_count' => 20]);
     _elgg_services()->db->addQuerySpec(['sql' => 'DELETE FROM A WHERE c = :c', 'params' => [':c' => 'c']]);
     $this->assertEquals(20, delete_data('DELETE FROM A WHERE b = :b', [':b' => 'b']));
     $this->assertEquals(0, delete_data('DELETE FROM A WHERE c = :c', [':c' => 'c']));
 }
开发者ID:elgg,项目名称:elgg,代码行数:7,代码来源:DatabaseTest.php

示例4: deleteAll

function deleteAll($db)
{
    $DELETED_MANUFACTER_CATEGORY = 2;
    //подключение к БД
    $link = $db->connectToDb();
    $table_prefix = $db->getTablePrefix() . $db->getVMTablePrefix();
    $query_parent_categories = "select category_child_id from " . $table_prefix . "category_categories where category_parent_id=0";
    $result = mysql_query($query_parent_categories, $link);
    $rows_num = mysql_num_rows($result);
    //if record doesn't exist insert record in tables
    if ($rows_num > 0) {
        while ($row = mysql_fetch_row($result)) {
            $category_nums[] = $row[0];
        }
    }
    $table_delete = array($table_prefix . "categories", $table_prefix . "categories_ru_ru", $table_prefix . "category_medias");
    $table_error .= delete_data($table_delete, "virtuemart_category_id not in('" . implode("','", $category_nums) . "')", $link);
    $table_delete = array($table_prefix . "category_categories");
    $table_error .= delete_data($table_delete, "category_child_id not in('" . implode("','", $category_nums) . "')", $link);
    $table_delete = array($table_prefix . "manufacturers_ru_ru", $table_prefix . "manufacturer_medias");
    $table_error .= delete_data($table_delete, "virtuemart_manufacturer_id in (SELECT virtuemart_manufacturer_id from " . $table_prefix . "manufacturers \nWHERE virtuemart_manufacturercategories_id=2)", $link);
    $table_delete = array($table_prefix . "manufacturers");
    $table_error .= delete_data($table_delete, "virtuemart_manufacturercategories_id=" . $DELETED_MANUFACTER_CATEGORY, $link);
    $table_delete = array($table_prefix . "import", $table_prefix . "products", $table_prefix . "products_ru_ru", $table_prefix . "product_categories", $table_prefix . "product_manufacturers", $table_prefix . "product_medias", $table_prefix . "product_relations", $table_prefix . "product_prices", $table_prefix . "product_shoppergroups", $table_prefix . "product_customfields");
    $table_error .= delete_data($table_delete, '1', $link);
    if ($table_error != '') {
        echo "<p style='color:red;'>" . 'При удалении возникли ошибки, таблицы: ' . $table_error . "</p>";
    } else {
        echo "<p style='color:blue;'>" . 'Удаление прошло успешно!' . "</p>";
    }
}
开发者ID:romuland,项目名称:khparts,代码行数:31,代码来源:delete_all.php

示例5: revoke

 /**
  * Revoke an api user key.
  *
  * @param string $api_key   The API Key (public)
  * @return bool
  */
 public function revoke($api_key)
 {
     $user = $this->get($api_key);
     if ($user) {
         return delete_data("DELETE from {$this->dbprefix}api_users\n\t\t\t\t\t\t\t\t\tWHERE id={$user->id}");
     }
     return false;
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:14,代码来源:KeysService.php

示例6: openid_server_delete_entity

function openid_server_delete_entity($entity)
{
    global $CONFIG;
    $entity->clearMetadata();
    $entity->clearAnnotations();
    $guid = $entity->getGUID();
    delete_data("DELETE from {$CONFIG->dbprefix}entities where guid={$guid}");
}
开发者ID:lorea,项目名称:Hydra-dev,代码行数:8,代码来源:openid_server_include.php

示例7: remove_from_river_by_object

/**
 * Removes all items relating to a particular entity being acted upon from the river
 *
 * @param int $object_guid The GUID of the entity
 * @return true|false Depending on success
 */
function remove_from_river_by_object($object_guid)
{
    // Sanitise
    $object_guid = (int) $object_guid;
    // Load config
    global $CONFIG;
    // Remove
    return delete_data("delete from {$CONFIG->dbprefix}river where object_guid = {$object_guid}");
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:15,代码来源:river2.php

示例8: remove_api_user

/**
 * Revoke an api user key.
 *
 * @param string $api_key   The API Key (public).
 *
 * @return bool
 */
function remove_api_user($api_key)
{
    $dbprefix = elgg_get_config('dbprefix');
    $keypair = get_api_user($api_key);
    if ($keypair) {
        return delete_data("DELETE from {$dbprefix}api_users where id={$keypair->id}");
    }
    return false;
}
开发者ID:elgg,项目名称:elgg,代码行数:16,代码来源:api_user.php

示例9: remove_api_user

/**
 * Revoke an api user key.
 *
 * @param int    $site_guid The GUID of the site.
 * @param string $api_key   The API Key (public).
 *
 * @return bool
 */
function remove_api_user($site_guid, $api_key)
{
    global $CONFIG;
    $keypair = get_api_user($site_guid, $api_key);
    if ($keypair) {
        return delete_data("DELETE from {$CONFIG->dbprefix}api_users where id={$keypair->id}");
    }
    return false;
}
开发者ID:ibou77,项目名称:elgg,代码行数:17,代码来源:api_user.php

示例10: unset_config

/**
 * Unset a config option.
 *
 * @param string $name The name of the field.
 * @param int $site_guid Optionally, the GUID of the site (current site is assumed by default).
 * @return mixed
 */
function unset_config($name, $site_guid = 0)
{
    global $CONFIG;
    $name = mysql_real_escape_string($name);
    $site_guid = (int) $site_guid;
    if ($site_guid == 0) {
        $site_guid = (int) $CONFIG->site_id;
    }
    return delete_data("delete from {$CONFIG->dbprefix}config where name='{$name}' and site_guid={$site_guid}");
}
开发者ID:portokallidis,项目名称:Metamorphosis-Meducator,代码行数:17,代码来源:configuration.php

示例11: upgrade_izap_videos_to

function upgrade_izap_videos_to($version)
{
    global $CONFIG;
    $update_entity_subtype = "UPDATE {$CONFIG->dbprefix}entity_subtypes SET class = 'IzapVideos' WHERE subtype = 'izap_videos'";
    $del_entity_query = "DELETE FROM {$CONFIG->dbprefix}entities\n                WHERE subtype IN (SELECT id FROM {$CONFIG->dbprefix}entity_subtypes\n                                  WHERE subtype='izapVideoQueue')";
    $del_queue_object_query = "DELETE FROM {$CONFIG->dbprefix}entity_subtypes where subtype='izapVideoQueue'";
    if (update_data($update_entity_subtype) || (delete_data($del_entity_query) || delete_data($del_queue_object_query))) {
        datalist_set('izap_videos_version', $version);
    }
}
开发者ID:rimpy,项目名称:izap_videos,代码行数:10,代码来源:upgrade.php

示例12: removeExpiredTokens

 /**
  * Remove expired tokens
  * @return bool
  */
 public function removeExpiredTokens()
 {
     $time = time();
     $result = delete_data("DELETE FROM {$this->dbprefix}users_apisessions\n\t\t\t\t\t\t\t\tWHERE expires < {$time}");
     if (elgg_in_context('cron')) {
         if ($result !== false) {
             return "{$result} expired user tokens were removed" . PHP_EOL;
         } else {
             return "ERROR: Expired user tokens could not be removed" . PHP_EOL;
         }
     }
     return $result;
 }
开发者ID:hypejunction,项目名称:hypegraph,代码行数:17,代码来源:TokenService.php

示例13: Data

 /**
 * Data Add
 *
 * @access system
 * @return return;
 */
 public static function Data($query, $type)
 {
     global $CONFIG;
     $query = str_replace('prefixes_', $CONFIG->dbprefix, $query);
     if (!empty($query) && $type == 'get') {
         return get_data($query);
     }
     if (!empty($query) && $type == 'delete') {
         return delete_data($query);
     }
     if (!empty($query) && $type == 'add') {
         return insert_data($query);
     }
     if (!empty($query) && $type == 'run') {
         return run_sql_script($query);
     }
 }
开发者ID:Twizanex,项目名称:OhYesChat,代码行数:23,代码来源:OhYesChat.php

示例14: subsite_manager_upgrade_system_handler

function subsite_manager_upgrade_system_handler($event, $type, $entity)
{
    if (get_input("all") == "true") {
        // find subsites and do stuff
        $options = array("type" => "site", "subtype" => Subsite::SUBTYPE, "limit" => false);
        // this could take a while
        set_time_limit(0);
        $batch = new ElggBatch("elgg_get_entities", $options);
        $viewtypes = elgg_get_config("view_types");
        $dataroot = elgg_get_config("dataroot");
        foreach ($batch as $subsite) {
            // clear simplecache
            $dir = $dataroot . "views_simplecache/" . $subsite->getGUID() . "/";
            if (file_exists($dir) && ($handle = opendir($dir))) {
                // remove files
                while (false !== ($file = readdir($handle))) {
                    if (!is_dir($dir . $file)) {
                        unlink($dir . $file);
                    }
                }
                closedir($handle);
            }
            if (!empty($viewtypes) && is_array($viewtypes)) {
                foreach ($viewtypes as $viewtype) {
                    datalist_set("sc_lastupdate_" . $viewtype . "_" . $subsite->getGUID(), 0);
                    datalist_set("sc_lastcached_" . $viewtype . "_" . $subsite->getGUID(), 0);
                }
            }
            // clear system cache
            $system_cache = new ElggFileCache($dataroot . "system_cache/" . $subsite->getGUID() . "/");
            $system_cache->clear();
            // cleanup cron cache
            $cron_cache = $dataroot . "subsite_manager/" . $subsite->getGUID() . "/cron_cache.json";
            if (file_exists($cron_cache)) {
                unlink($cron_cache);
            }
            // reset translation editor cache
            // can't use remove_private_setting because of 'name like' not 'name ='
            $sql = "DELETE FROM " . get_config("dbprefix") . "private_settings";
            $sql .= " WHERE name LIKE 'te_last_update_%'";
            $sql .= " AND entity_guid = " . $subsite->getGUID();
            delete_data($sql);
        }
    }
}
开发者ID:pleio,项目名称:subsite_manager,代码行数:45,代码来源:events.php

示例15: del

 public function del()
 {
     //1、根据点击删除传递过来的ID获取相关数据
     $ids = I('ids');
     $map['id'] = array("in", $ids);
     $result = get_result($this->table, $map);
     //2、获取评论内容中的图片并删除
     foreach ($result as $key => $value) {
         //删除内容中的图片
         delStrImgs($value['content']);
         //3、统计评论删除后新闻的评论数量
         $_POST['id'] = $value['product_id'];
         $_POST['comment'] = count_data($this->table, array("product_id" => $value['product_id']));
         update_data("article");
     }
     //4、删除数据表中的数据
     delete_data($this->table, $map);
     $this->success("删除成功");
 }
开发者ID:976112643,项目名称:manor,代码行数:19,代码来源:CommentController.class.php


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