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


PHP medoo::update方法代码示例

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


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

示例1: medoo

<?php

/*
*		功能:更新个人信息
*
*/
session_start();
header("Content-type:text/html; charset=utf8");
include_once './medoo/medoo.php';
$database = new medoo();
$Sname = $_SESSION['name'];
if ($_POST['submit']) {
    $name = $_POST['name'];
    $sex = $_POST['sex'];
    $posit = $_POST['posit'];
    $birth = $_POST['birth'];
    $tel = $_POST['tel'];
    $qq = $_POST['qq'];
    $sql = $database->update("user", array("name" => $name, "sex" => $sex, "depart" => $posit, "birth" => $birth, "tel" => $tel, "qq" => $qq), array("name" => $Sname));
    // 判断是否更新成功
    if ($sql) {
        echo "<script> alert('更新信息成功!'); history.go(-1);</script>";
    } else {
        echo "<script> alert('更新信息失败!'); history.go(-1);</script>";
    }
}
开发者ID:a707937337,项目名称:EcjtuOA,代码行数:26,代码来源:info.update.php

示例2: header

<?php

session_start();
// error_reporting(null);
if (!isset($_SESSION['uid'])) {
    header("Location: login.php");
    exit;
}
date_default_timezone_set('Asia/Shanghai');
include "./medoo.min.php";
$database = new medoo();
if (isset($_GET['qid']) && isset($_POST['reply'])) {
    $name = $database->select("user", "name", array("id" => $_SESSION['uid']));
    $database->insert("answer", array("qid" => $_GET['qid'], "name" => $name[0], "content" => $_POST['reply']));
    $database->update("question", array("isanswer" => 1), array("id" => $_GET['qid']));
    header("Location: my.php");
}
开发者ID:xiezhiwei12138,项目名称:jdqn_ecjtu_net,代码行数:17,代码来源:ajax_answer.php

示例3: PayMoney

$app->get("/buy", function () use($app) {
    try {
        $app->render("buy.html");
    } catch (Exception $e) {
        $app->notfound();
    }
});
$app->get("/buy/:uid/:month/:price", function ($uid, $month, $price) use($app, $databases) {
    try {
        $datas = $databases->select("user", "expire", array("uuid" => $uid, "ORDER" => array("id DESC", "time DESC"), "LIMIT" => array(0, 1)));
        $num;
        $expire = time() + $month * 30 * 24 * 3600;
        $num = $databases->insert("user", array("uuid" => $uid, "expire" => $expire, "price" => $price, "strtime" => $month, "ispay" => 0));
        $ispay = PayMoney($price, $uid, $month, $num);
        if ($ispay) {
            $sure = $databases->update("user", array("ispay" => 1), array("AND" => array("uuid" => $uid, "id" => $num)));
        }
        $type = $app->getCookie("ctype") ? $app->getCookie("ctype") : 1;
        $app->redirect("../../../thirdindex/" . $uid . "/" . $type);
    } catch (Exception $e) {
        $app->notfound();
    }
});
$app->run();
function PayMoney($money = 0, $uid, $month, $order_num)
{
    if ($money != 0) {
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, "http://hdtv.xmbtn.com/hdtv/api/paylock/ajax/add");
        $post_data = array("stbid" => $uid, "username" => "test", "token" => "uS6jBRN9shDtDf5R", "amount" => $money * 100, "order_msg" => iconv("UTF-8", "GBK", "购买庄子识字套餐" . $month . "个月"), "extra_msg" => "", "cp" => iconv("UTF-8", "GBK", "庄子快速识字"), "name" => iconv("UTF-8", "GBK", "购买套餐"), "type" => iconv("UTF-8", "GBK", "购买套餐"), "order_num" => $order_num);
        $query_data = http_build_query($post_data);
开发者ID:shangwo,项目名称:letter,代码行数:31,代码来源:router.php

示例4: update

 /**
  * @param string $table
  * @param array $data
  * @param array $where
  * @return bool|int
  */
 public function update($table, $data, $where = null)
 {
     $re = parent::update($table, $data, $where);
     $this->lastSql = $this->last_query();
     $this->lastError = $this->error();
     return $re;
 }
开发者ID:wwtg99,项目名称:data_pool,代码行数:13,代码来源:MedooPlus.php

示例5: importData

/**
 * 导入数据到 wd_120answer_temp 中
 * @author gaoqing
 * 2015年11月9日
 * @param array $initAskArr 初始要导入的问答信息集
 * @param int $preInsertCount 每次插入的条数
 * @param medoo $connection 连接数据库对象
 * @param int $sleepSeconds 休眠的秒数
 * @return int $importCount 成功导入的信息数
 */
function importData($initAskArr, $preInsertCount, $connection, $sleepSeconds)
{
    $importCount = 0;
    $data = array("isimport" => 1);
    $insertArr = array();
    $updateIDArr = array();
    $initAskArrCount = count($initAskArr);
    foreach ($initAskArr as $key => $initAsk) {
        if ($key % 100 == 0) {
            sleep($sleepSeconds);
        }
        $insertArr[] = getInserArr($initAsk);
        $updateIDArr[] = $initAsk['id'];
        if ($key % $preInsertCount == $preInsertCount - 1 || $key == $initAskArrCount - 1) {
            //将 $insertArr 数组集,插入到 wd_fhanswer_temp 中
            if (!empty($insertArr)) {
                //插入到 wd_120answer_temp 中
                $idArr = $connection->insert(IMPORT_TABLE, $insertArr);
                $importCount += count($insertArr);
                $insertArr = array();
                //更新 wd_120answer_keshi 中的信息
                $where = array('id' => $updateIDArr);
                $connection->update(SELECT_TABLE, $data, $where);
                $updateIDArr = array();
            }
        }
    }
    return $importCount;
}
开发者ID:VampireMe,项目名称:Common_PHP,代码行数:39,代码来源:importData2Local.php

示例6: save

 /**
  * Save cahges to DB
  * @param array $args
  * @param bool $extCall
  * @return bool True in case of success
  * @throws FatalError
  * @throws \Exception
  */
 public function save($args, $extCall = false)
 {
     $this->gp->checkAccess(__FUNCTION__, $extCall);
     $id = self::extractId($args);
     if (empty($id)) {
         throw new \Exception('Id is not valid');
     }
     if (is_numeric($args)) {
         $args = array('id' => $id);
     }
     $parsed_arg = $this->checkArguments($args);
     if ($this->isImplement("FileManage")) {
         $uploadedData = $this->saveUploadedFile($id);
         $parsed_arg = array_replace_recursive($parsed_arg, $uploadedData);
     }
     $parsed_arg = $this->parseJson($parsed_arg, true);
     if (EMA_DEBUG && EMA_LOG_SQL_QUERIES) {
         $this->logUpdateQuery($this->dbTable, $parsed_arg, array("id" => $id));
     }
     $dbData = $this->dbConnection->update($this->dbTable, $parsed_arg, array("id" => $id));
     if (is_int($dbData) === false) {
         $this->throwMysqlError();
     }
     if ($this->isImplement("Sitemap")) {
         $this->generateSitemap();
     }
     if ($this->isImplement("RssFeed")) {
         $this->rssFeedUpdate();
     }
     return true;
 }
开发者ID:indiwine,项目名称:EMA-engine,代码行数:39,代码来源:RootClass.php

示例7: listOP

            header("location: ../../index.php");
        } else {
            header("location: ../../login.php?error");
        }
    } else {
        header("location: ../../login.php?error");
    }
}
if ("logout" === $action) {
    session_unset();
    header("location: ../../login.php");
}
if ("modify_pw" === $action) {
    $oldpw = $_GET["oldPw"];
    $newpw = $_GET["newPw"];
    $database->update("gr_op", ["pw" => $newpw], ["opid" => $_SESSION["opid"]]);
    echo "密码修改成功!2秒后跳转...";
    echo '<meta http-equiv="refresh" content="2;URL=../../index.php">';
}
if ("listAllOP" === $action) {
    listOP();
    header("location: ../../op.php");
}
function listOP()
{
    global $database;
    $allOP = $database->select("gr_op", "*");
    $_SESSION["allOP"] = $allOP;
}
if ("addOP" === $action) {
    $opid = htmlspecialchars($_GET["opid"]);
开发者ID:bluestonemds,项目名称:gongre,代码行数:31,代码来源:Controller.php

示例8: json_encode

<?php

require '../vendor/autoload.php';
require '../secrets.php';
$data = json_decode(urldecode($_GET['data']), true);
$data['address'] = $_SERVER['REMOTE_ADDR'];
$output = array();
$hash = md5($data['address'] . ":" . $data['port']);
$disableDB = false;
if (!$disableDB) {
    try {
        $database = new medoo(['database_type' => 'mysql', 'database_name' => $dbname, 'server' => $dbhost, 'username' => $dbuser, 'password' => $dbpass, 'port' => $dbport, 'charset' => 'utf8']);
    } catch (Exception $e) {
        die("Failed to connect to the database\r\n");
    }
    $record = $database->get("server", "id", ["id" => $hash]);
    if (empty($record)) {
        $database->insert("server", ["id" => $hash, "address" => $data['address'], "port" => $data['port'], "lastupdate" => time()]);
        $database->insert("server_details", ["serverid" => $hash, "players" => $data['currentPlayers'], "slots" => $data['maxPlayers'], "memory" => $data['systemRam']]);
    } else {
        $database->update("server", ["id" => $hash, "address" => $data['address'], "port" => $data['port'], "lastupdate" => time()], ["id" => $hash]);
        $database->update("server_details", ["serverid" => $hash, "players" => $data['currentPlayers'], "slots" => $data['maxPlayers'], "memory" => $data['systemRam']], ["serverid" => $hash]);
    }
}
$output["success"] = "Ok";
echo json_encode($output);
开发者ID:WhiteXZ,项目名称:Yuuki,代码行数:26,代码来源:legacy-stage.php

示例9: medoo

ini_set('display_errors', 'On');
error_reporting(E_ALL);
require 'lib/medoo.php';
try {
    $database = new medoo(['database_type' => 'mysql', 'database_name' => 'recipe', 'server' => 'localhost', 'username' => 'recipe', 'password' => 'mPu92jfqRJSVMa8H', 'charset' => 'utf8']);
    $request_body = file_get_contents('php://input');
    if ($request_body != null) {
        $json = json_decode($request_body, true);
        if ($json['data']) {
            $json = $json['data'];
        }
        $resultObj = array();
        if ($json['recipe_id'] != null) {
            $recipe_id = $json['recipe_id'];
            $where = ['recipe_id' => $recipe_id];
            $result = $database->update("recipe", $json, $where);
        } else {
            $result = $database->insert("recipe", $json);
            $resultObj["recipe_id"] = $result;
        }
        print_r(json_encode($resultObj));
    } else {
        $data = $database->select("recipe", "*", []);
        foreach ($data as &$row) {
            $ingredients = $database->select("recipe_ingredient", ["[>]ingredient" => "ingredient_id", "[>]measure" => "measure_id"], "*", ["recipe_id" => $row["recipe_id"]]);
            $row["ingredients"] = $ingredients;
            foreach ($ingredients as &$ing) {
                if ($ing["amount"] == 1) {
                    $ing["measure"] = $ing["measure_abbr"];
                } else {
                    $ing["measure"] = $ing["measure_plural_abbr"];
开发者ID:pederszt,项目名称:secret_h,代码行数:31,代码来源:recipe-backing.php

示例10: VALUES

$con = mysql_connect($config['db']['server'], $config['db']['username'], $config['db']['password']);
//change configs
$db = mysql_select_db($config['db']['database_name'], $con);
//change database
$c_id = $_POST["courseid"];
foreach ($_POST as $key => $value) {
    if ($key != "courseid") {
        // echo "$key"."-->"."$value[0]"."<br>";
        // echo "$key"."-->"."$value[1]"."<br>";
        // echo "<br>"."<br>";
        mysql_query("INSERT INTO `feedback` (`question_id`,`answer`,`comment`,`courseid`) VALUES ('{$key}','{$value['0']}','{$value['1']}','{$c_id}')") or die(mysql_error());
    }
}
//update student course linkage
$db = new medoo($config['db']);
$db->update('student_course', ['done' => 1], ["AND" => ['student' => $userid, 'course' => $c_id]]);
?>
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Feedback successful</title>

    <!-- Bootstrap -->
    <link href="<?php 
echo $config['url']['base_url'];
?>
/css/bootstrap.min.css" rel="stylesheet">
开发者ID:rahulnagurtha,项目名称:Online-Course-Feedback-Portal,代码行数:30,代码来源:feedback2.php

示例11: medoo

<?php

require 'medoo.min.php';
$id = $_POST['id'];
$view = $_POST['view'];
echo $id . $view;
//print_r($_POST);
$database = new medoo(array('database_type' => 'mysql', 'database_name' => 'garantmarket', 'server' => 'localhost', 'username' => 'root', 'password' => '', 'charset' => 'utf8'));
//$database = new medoo(array(
//	'database_type' => 'mysql',
//	'database_name' => 'garantma_db',
//	'server' => 'localhost',
//	'username' => 'garantma_user',
//	'password' => 'crKAyqBMMaEq',
//	'charset' => 'utf8'
//    ));
if ($view == 'not') {
    $database->update("catalog", array("view" => false), array("id" => $id));
} else {
    $database->update("catalog", array("view" => true), array("id" => $id));
}
开发者ID:pioytazsko,项目名称:garantmarket,代码行数:21,代码来源:view_item.php

示例12: ord

    // e.g 'F'
    $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
    $nrColumns = ord($highestColumn) - 64;
    //    echo "<br>The worksheet ".$worksheetTitle." has ";
    //    echo $nrColumns . ' columns (A-' . $highestColumn . ') ';
    //    echo ' and ' . $highestRow . ' row.';
    //    echo '<br>Data: <table border="1"><tr>';
    for ($row = 1; $row <= $highestRow; ++$row) {
        //        echo '<tr>';
        //        for ($col = 0; $col < $highestColumnIndex; ++ $col) {
        //            $cell = $worksheet->getCellByColumnAndRow($col, $row);
        //            $val = $cell->getValue();
        //            $dataType = PHPExcel_Cell_DataType::dataTypeForValue($val);
        //            echo '<td>' . $val . '<br>(Typ ' . $dataType . ')</td>';
        //        }
        //        echo '</tr>';
        // отправка данных в бд
        $id = $worksheet->getCellByColumnAndRow(0, $row)->getValue();
        $dataType = PHPExcel_Cell_DataType::dataTypeForValue($id);
        if ($dataType == 'n') {
            $name = $worksheet->getCellByColumnAndRow(1, $row)->getValue();
            $manufected = $worksheet->getCellByColumnAndRow(2, $row)->getValue();
            $price = $worksheet->getCellByColumnAndRow(3, $row)->getValue();
            $title = $worksheet->getCellByColumnAndRow(4, $row)->getValue();
            //            echo $dataType.$price;
            $database->update("catalog", array("name" => $name, "price" => $price, "title" => $title), array("id" => $id));
        }
        //        $database
    }
}
header('Location:http://garantmarket.by/admin/catalog.php?idp=26');
开发者ID:pioytazsko,项目名称:garantmarket,代码行数:31,代码来源:import_exel.php

示例13: medoo

<?php

/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/7/1
 * Time: 16:41
 */
include '../../parameter/Medoo/Resource/medoo.php';
//改变meeting的状态,
$id = $_POST['id'];
$db = new medoo("meetingmanage");
$db->update("meeting", array("STATE" => 0), array("MEETING_ID" => $id));
//改变attendentce的状态
$db->update("attendence", array("STATE" => 0), array("MEETING_ID" => $id));
开发者ID:keensting,项目名称:MeetingManageSystem,代码行数:15,代码来源:ajax_end_meeting.php

示例14: medoo

<?php

require_once 'meedoo.php';
require_once 'config.php';
$database = new medoo();
$mealID = $_POST["mealID"];
$position = $_POST["position"];
$positionOrder = $_POST["positionOrder"];
$update = $database->update("meals", ["position" => $position, "PositionOrder" => $positionOrder], ["mealID" => $mealID]);
if ($update) {
    echo 'good';
} else {
    echo 'bad';
}
开发者ID:ltlam93,项目名称:meals,代码行数:14,代码来源:meal-update-position.php

示例15: match

    $title = match('/<td class="titleColumn">.*?<a.*?>(.*?)<\\/a>/msi', $m, 1);
    $year = match('/<td class="titleColumn">.*?<span.*?>\\((.*?)\\)<\\/span>/msi', $m, 1);
    $rating = match('/<td class="ratingColumn">.*?<strong.*?>(.*?)<\\/strong>/msi', $m, 1);
    $poster = match('/<td class="posterColumn">.*?<img src="(.*?)"/msi', $m, 1);
    $votesURL = "http://www.imdb.com/title/" . $id . "/";
    $votes = getvotes($votesURL);
    // create each movie object and set the variables
    $movie = new Movie();
    $movie->setId($id);
    $movie->setRank($rank);
    $movie->setTitle($title);
    $movie->setYear($year);
    $movie->setRating($rating);
    $movie->setVotes($votes);
    // insert $movie objects into an array
    array_push($top10Movies, $movie);
    // stop at 10
    if ($rank == 10) {
        break;
    }
}
$date = $db->select("movies", "date_added");
// insert into database using medoo if it does not exist
foreach ($top10Movies as $movie) {
    // check database for matching date, if same day update, else insert
    if (in_array($today, $date)) {
        $db->update("movies", ["imdb_id" => $movie->getId(), "rank" => $movie->getRank(), "rating" => $movie->getRating(), "title" => $movie->getTitle(), "year" => $movie->getYear(), "number_of_votes" => $movie->getVotes(), "date_added" => $today], ["date_added" => $today, "rank" => $movie->getRank()]);
    } else {
        $db->insert("movies", ["imdb_id" => $movie->getId(), "rank" => $movie->getRank(), "rating" => $movie->getRating(), "title" => $movie->getTitle(), "year" => $movie->getYear(), "number_of_votes" => $movie->getVotes(), "date_added" => $today]);
    }
}
开发者ID:abacaj,项目名称:IMDB-PHP-Parser,代码行数:31,代码来源:movies_script.php


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