• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP update函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: month_total_fee

function month_total_fee($month)
{
    $year = explode('-', $month)[0];
    $mon = explode('-', $month)[1];
    //获取需要的月份相应交费记录并计算总费用
    $sql = "select fee,date,dueDate from hh_fee";
    $rows = fetchAll($sql);
    $total = 0;
    foreach ($rows as $row) {
        $day1 = $row['date'];
        $day2 = $row['dueDate'];
        $fee = $row['fee'];
        $T = ceil($fee / days_dis($day1, $day2));
        //$T为 该笔学费每天的收入
        $days = month_days($day1, $day2, $month);
        if ($days) {
            $total = $days * $T + $total;
        }
    }
    $arr = array('year' => $year, 'month' => $mon, 'total' => $total);
    //如果已存在相应日期记录,则进行更新操作,否则进行插入
    $sql = "select count(total) from hh_totalFee where year={$year} and month={$mon}";
    $result = fetchOne($sql)['count(total)'];
    if ($result >= 1) {
        update('hh_totalFee', $arr, "year={$year} and month={$mon}");
    } else {
        insert('hh_totalFee', $arr);
    }
}
开发者ID:hardihuang,项目名称:happyhome_admin,代码行数:29,代码来源:analyze.inc.php


示例2: contact_delete

 public function contact_delete($id)
 {
     $data_update = array('is_delete' => 1);
     update('inquiry', $id, $data_update);
     $this->session->set_flashdata('success', 'Inquiry has been deleted.');
     redirect('admin/inquiry/contact');
 }
开发者ID:virendrapatel99,项目名称:surat,代码行数:7,代码来源:Inquiry.php


示例3: update

function update($folder = '')
{
    if (empty($folder)) {
        return false;
    }
    $files = array();
    if ($dir = @opendir($folder)) {
        while (($file = readdir($dir)) !== false) {
            if (in_array($file, array('.', '..'))) {
                continue;
            }
            if (is_dir($folder . '/' . $file)) {
                $files2 = update($folder . '/' . $file);
                if ($files2) {
                    $files = array_merge($files, $files2);
                }
                $GLOBALS['pastas'][] = $folder . '/' . $file;
            } else {
                $GLOBALS['arquivos'][] = $folder . '/' . $file;
            }
        }
    }
    @closedir($dir);
    return $files;
}
开发者ID:Reallogic,项目名称:moip-opencart-valdeir,代码行数:25,代码来源:funcoes.php


示例4: delete

 public function delete($id)
 {
     $data_update = array('is_delete' => 1);
     update('floorplan_category', $id, $data_update);
     $this->session->set_flashdata('success', 'Floorplan Category has been Deleted Successfully.');
     redirect('admin/floorplan_category/index');
 }
开发者ID:virendrapatel99,项目名称:surat,代码行数:7,代码来源:Floorplan_category.php


示例5: editUser

/**
 *编辑商品
 * @param int $id
 * @return string
 */
function editUser($id)
{
    $arr = $_POST;
    $path = "../uploads";
    $uploadFiles = uploadFile($path);
    $where = "id={$id}";
    $totalCap = getCityCapById(getcIdById($id)) - getCapById($id) + $arr['capacity'];
    //减去旧的,加上新的
    $sql = "update biogas_city set totalCap=" . $totalCap . " where id=" . getcIdById($id);
    mysql_query($sql);
    //更新城市的总池容
    $res = update("biogas_user", $arr, $where);
    $uid = $id;
    if ($res && $uid) {
        if ($uploadFiles && is_array($uploadFiles)) {
            foreach ($uploadFiles as $uploadFile) {
                $arr1['uid'] = $uid;
                $arr1['albumPath'] = $uploadFile['name'];
                addAlbum($arr1);
            }
        }
        $mes = "<p>编辑成功!</p><a href='listUser.php' target='mainFrame'>查看用户列表</a>";
    } else {
        $mes = "<p>编辑失败!</p><a href='listUser.php' target='mainFrame'>重新编辑</a>";
    }
    return $mes;
}
开发者ID:BigeyeDestroyer,项目名称:biogas,代码行数:32,代码来源:user.inc.php


示例6: apiDelete

function apiDelete()
{
    //接口id
    $id = I($_POST['id']);
    $sql = "update api set isdel='1' where id='{$id}'";
    $re = update($sql);
    die($re ? '1' : '0');
}
开发者ID:qiqisteve,项目名称:ApiManager,代码行数:8,代码来源:ajax.php


示例7: apiDelete

function apiDelete()
{
    //接口id
    $id = I($_POST['id']);
    $sql = "update " . session('login_name') . "_api set isdel='1' where id='{$id}'";
    $re = update($sql);
    die($re ? '1' : '0');
}
开发者ID:JimChenAnother,项目名称:ApiManager,代码行数:8,代码来源:ajax.php


示例8: restoreAction

function restoreAction()
{
    $id = $_GET['id'];
    update('products', array('isRecycle' => 0), 'id=' . $id);
    $message = '商品已经成功还原';
    $redirect = '<a href="recyclePro.php">返回回收站</a>';
    require_once 'thems/a.html';
}
开发者ID:denson7,项目名称:phpstudy,代码行数:8,代码来源:productAction.inc.php


示例9: child_render

function child_render($param)
{
    global $g_page, $g_cfg;
    $g_page["frame"] = "site_admin/frame.html";
    if (!http_user_auth("admin", "admin")) {
        return redirect("/");
    }
    if (isset($param[1]) && $param[1] == "switch_status") {
        list($cname, $p) = [$_GET["name"], $_GET["p"]];
        if ($p == "close") {
            dbupdate("sys_variations", [], ["test" => $cname], ["completed" => "now()"]);
        }
        return redirect("/stats/multivariants");
    }
    $q = gettable("select * from sys_variations where completed is null");
    $t = [];
    foreach ($q as $row) {
        if (!isset($t[$row["test"]])) {
            $t[$row["test"]] = [];
        }
        if (!isset($t[$row["test"]][$row["variation"]])) {
            $t[$row["test"]][$row["variation"]] = ["goals" => []];
        }
        $t[$row["test"]][$row["variation"]]["content"] = substr($row["content"], 0, 256);
        $cm = new Variant($row["test"]);
        $t[$row["test"]][$row["variation"]]["enrolled"] = $cm->get() == $row["variation"] ? 1 : 0;
        $t[$row["test"]][$row["variation"]]["variation"] = $row["variation"];
        $cv = [];
        $cgoal = $row;
        $cgoal["pc"] = $row["sample"] == 0 ? "N/A" : round($row["conversion"] / $row["sample"] * 100, 2);
        $t[$row["test"]][$row["variation"]]["goals"][] = $cgoal;
        $t[$row["test"]][$row["variation"]] = update($t[$row["test"]][$row["variation"]], $cv);
    }
    $res = [];
    foreach ($t as $name => $row) {
        $cm = [];
        foreach ($t[$name] as $varname => $cvar) {
            uasort($cvar["goals"], function ($a, $b) {
                global $g_mv_goals;
                if (($i = array_search($a["goal"], $g_mv_goals)) === false) {
                    return -1;
                }
                if (($j = array_search($b["goal"], $g_mv_goals)) === false) {
                    return -1;
                }
                if ($i == $j) {
                    return 0;
                }
                return $i > $j ? 1 : -1;
            });
            $cm[] = $cvar;
        }
        $res[] = ["test" => $name, "var" => $cm];
    }
    // print_r($res); exit;
    $scr = new Scriptor("site_admin/multivariants.html", ["tests" => $res]);
    return $scr->result();
}
开发者ID:sdrinf,项目名称:cog,代码行数:58,代码来源:multivariants.php


示例10: put_evaluation

/**
 * @param \PDO $link
 * @return bool
 */
function put_evaluation($link)
{
    /**
     * @param PDO $link
     * @param string $user
     * @param string $field1
     * @param string $field2
     * @param string $lang
     * @param string $group
     * @param string $id1
     * @param string $id2
     * @param string $word
     * @param int $type
     */
    function update($link, $user, $field1, $field2, $lang, $group, $id1, $id2, $word, $type)
    {
        $sql = "SELECT associd FROM `associations` WHERE id1 = :id1 AND id2 = :id2 AND word = :word AND user = :user AND assigned_group = :group AND lang = :lang AND type = :type";
        $stmt = $link->prepare($sql);
        $stmt->bindValue(':id1', $id1, PDO::PARAM_STR);
        $stmt->bindValue(':id2', $id2, PDO::PARAM_STR);
        $stmt->bindValue(':word', $word, PDO::PARAM_STR);
        $stmt->bindValue(':type', $type, PDO::PARAM_INT);
        $stmt->bindValue(':user', $user, PDO::PARAM_STR);
        $stmt->bindValue(':group', $group, PDO::PARAM_STR);
        $stmt->bindValue(':lang', $lang, PDO::PARAM_STR);
        if ($stmt->execute() === false) {
            error_log(var_export($link->errorInfo(), true));
            die("Error performing database operation.");
        }
        if ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $sql = "INSERT INTO `evaluations` ( associd , evaluator , vote , popvote ) values ( :associd , :user , :vote , :popvote )";
            $stmt = $link->prepare($sql);
            $stmt->bindValue(':associd', $row['associd'], PDO::PARAM_STR);
            $stmt->bindValue(':user', $_SESSION['user_array']['user'], PDO::PARAM_STR);
            $stmt->bindValue(':vote', $field1 === 'upvotes' ? 2 : ($field1 === 'neutralvotes' ? 1 : 0), PDO::PARAM_INT);
            $stmt->bindValue(':popvote', $field2 === 'popupvotes' ? 2 : ($field2 === 'popneutralvotes' ? 1 : 0), PDO::PARAM_INT);
            if ($stmt->execute() === false) {
                error_log(var_export($link->errorInfo(), true));
                die("Error performing database operation.");
            }
        }
    }
    // Only the last presented item on a session can be evaluated
    // this is done on purpose, to avoid abuse.
    // A ticket is generated to ensure the item evaluation received
    // matches the presented item, both to avoid abuse and accidental
    // duplicates.
    if (!isset($_SESSION['rand_ticket']) || !isset($_SESSION['hashed_ticket']) || hash("sha256", $_SESSION['rand_ticket'] . $_SESSION['otheruser']) !== $_POST['ticket'] || $_SESSION['hashed_ticket'] !== hash("sha256", $_POST['ticket'] . $_POST['id1'] . $_POST['id2'])) {
        die("Bad ticket.");
    }
    unset($_SESSION['hashed_ticket']);
    unset($_SESSION['rand_ticket']);
    if (!isset($_POST['popvote']) || !isset($_POST['vote'])) {
        return false;
    }
    update($link, $_SESSION['otheruser'], $_POST['vote'], $_POST['popvote'], $_POST['lang'], $_POST['group'], $_POST['id1'], $_POST['id2'], $_POST['word'], $_POST['type']);
    return true;
}
开发者ID:elcodedocle,项目名称:synapp,代码行数:62,代码来源:put_evaluation.php


示例11: verwerk

function verwerk($id, $quant)
{
    // checken of product-id bestaat
    $id_query = tep_db_query("select * from " . TABLE_PRODUCTS . " where products_id = " . $id);
    $row = mysql_fetch_array($id_query);
    if ($row != '') {
        update($id, $quant);
    }
}
开发者ID:CristianCCIT,项目名称:shop4office,代码行数:9,代码来源:voorraad_update.php


示例12: update

 public function update($id, Request $request)
 {
     $input = update($request->all());
     $beritaa = Berita::findOrFail($id);
     $beritaa->judul = $input['judul'];
     $beritaa->isi = $input['isi'];
     $beritaa->save();
     return redirect('berita');
 }
开发者ID:evansumangkut,项目名称:contohkepo,代码行数:9,代码来源:BeritaController.php


示例13: editCate

/**
 * 修改类别
 * @param int $id
 * @return string
 */
function editCate($id)
{
    $arr = $_POST;
    if (update("imooc_cate", $arr, "id={$id}")) {
        $mes = "修改成功!<a href='listCate.php'>查看类别列表</a>";
    } else {
        $mes = "修改失败!<a href='listCate.php'>重新修改</a>";
    }
    return $mes;
}
开发者ID:hiden2,项目名称:shopImooc-1,代码行数:15,代码来源:cate.inc.php


示例14: editCity

function editCity($where)
{
    $arr = $_POST;
    if (update("biogas_city", $arr, $where)) {
        $mes = "修改成功!<br/><a href='listCity.php'>查看列表!</a>";
    } else {
        $mes = "修改失败!<br/><a href='listCity.php'>重新修改!</a>";
    }
    return $mes;
}
开发者ID:BigeyeDestroyer,项目名称:biogas,代码行数:10,代码来源:city.inc.php


示例15: editCate

/**
 * 修改分类的操作
 * @param string $where
 * @return string
 */
function editCate($where)
{
    $arr = $_POST;
    if (update("imooc_cate", $arr, $where)) {
        $mes = "分类修改成功!<br/><a href='listCate.php'>查看分类</a>";
    } else {
        $mes = "分类修改失败!<br/><a href='listCate.php'>重新修改</a>";
    }
    return $mes;
}
开发者ID:juedaiyuer,项目名称:codeworkplace,代码行数:15,代码来源:cate.inc.php


示例16: editCate

/**
 * 修改分类的操作
 * @param string $where
 * @return string
 */
function editCate($where)
{
    $arr = $_POST;
    if (update("tigris_user_type", $arr, $where)) {
        $mes = "Edit success!<br/><a href='listCate.php'>View list</a>";
    } else {
        $mes = "Edit failed!<br/><a href='listCate.php'>Edit</a>";
    }
    return $mes;
}
开发者ID:win87,项目名称:homarget2,代码行数:15,代码来源:cate.inc.php


示例17: editAdmin

function editAdmin($id)
{
    $arr = $_POST;
    $arr['password'] = md5($_POST['password']);
    if (update('gud_admin', $arr, "id={$id}")) {
        $mes = "编辑成功!</br><a href='listAdmin.php'>查看管理员列表</a>";
    } else {
        $mes = "编辑失败!</br><a href='listAdmin.php'>请重新修改</a>";
    }
    return $mes;
}
开发者ID:bdsiq,项目名称:shop_gud,代码行数:11,代码来源:admin.inc.php


示例18: editAdmin

function editAdmin($id)
{
    $arr = $_POST;
    $arr['password'] = md5($_POST['password']);
    if (update("biogas_admin", $arr, "id={$id}")) {
        $mes = "编辑成功!<br/><a href='listAdmin.php'>查看列表!</a>";
    } else {
        $mes = "编辑失败!<br/><a href='listAdmin.php'>重新编辑!</a>";
    }
    return $mes;
}
开发者ID:BigeyeDestroyer,项目名称:biogas,代码行数:11,代码来源:admin.inc.php


示例19: update_user_cookies

function update_user_cookies($u_id, $username, $email)
{
    //Add User Hash For Auto Login
    $user_hash = sha1($username + $email + time());
    //Function from DAL.php
    $sql = "update auto_login set a_u_hash = '{$user_hash}' where a_u_id = '{$u_id}' limit 1";
    $result = update($sql);
    //Set Cookie
    $expire = time() + 60 * 60 * 24 * 30;
    setcookie('remember_me', $user_hash, $expire, '/');
}
开发者ID:valeri4,项目名称:semiProjectlayers,代码行数:11,代码来源:autoLogin.php


示例20: editarticle

function editarticle($where){
	$arr=$_POST;
	if(update("dw_article",$arr,$where)){
		echo "修改成功,<a href='list_article.php'>查看文章列表</a>";
		//print_r($arr);
		}
	else
	{
		echo "修改失败!";
		}
	}
开发者ID:knight-zhou,项目名称:PHP-HTML,代码行数:11,代码来源:article.fun.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP updateCar函数代码示例发布时间:2022-05-23
下一篇:
PHP up函数代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap