<?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"); }
/** * @param string $table * @param array $join * @param string|array $columns * @param array $where * @return array|bool * * Or, * @param string $table * @param string|array $columns * @param array $where * @return array|bool */ public function select($table, $join, $columns = null, $where = null) { $re = parent::select($table, $join, $columns, $where); $this->lastSql = $this->last_query(); $this->lastError = $this->error(); return $re; }
protected function get_activity_list() { $local_db = new medoo(); $list = $local_db->select('activity', '*', array('state' => 1)); $list = two_dimension_array_sort::execute($list, 'id'); $this->assign('act_list', $list); }
/** * 得到 wd_120answer_keshi 中的指定条数的问答 * @author gaoqing * 2015年11月9日 * @param medoo $connection 连接数据库对象 * @param int $num 获取的条数 * @return array 指定条数的问答集 */ function getInitAsk($connection, $num) { $initAskArr = array(); $where = array("isimport" => 0, "LIMIT" => [0, $num], "ORDER" => "age"); $initAskArr = $connection->select(SELECT_TABLE, "*", $where); return $initAskArr; }
protected function get_salary_list() { $total = 0; $local = new medoo(); $user_list = array(); //需要发工资的大使的ekey列表 $salary_list = array(); //所有未结算列表 $list = $local->select('salary', array('[>]ambassador' => 'ekey'), array('ekey', 'num', 'ambassador.zfb_id', 'ambassador.name'), array('is_give' => 0)); // print_r($list); //检索出用户列表,拍重,统计总额 foreach ($list as $v) { $total += $v['num']; $user_list[$v['ekey']] = ''; } //填充工资列表的工资总额 foreach ($user_list as $k => $v) { $num = 0; $name = ''; $zfb_id = ''; foreach ($list as $l) { if ($l['ekey'] == $k) { $num += $l['num']; $name = $l['name']; $zfb_id = $l['zfb_id']; } } $salary_list[] = array('name' => $name, 'ekey' => $k, 'num' => $num, 'zfb_id' => $zfb_id); } $this->assign('info', array('total' => $total, 'person' => count($user_list))); $this->assign('salary_list', $salary_list); }
protected final function dbQuery($where) { $result = $this->dbConnection->select(AUTOLOADER_TABLE, array('[>]' . self::GP_CLASS_METHODS_TABLE => array('id' => 'classId')), '*', $where); if ($result === false) { throw new FatalError('Error getting GP policy: ' . print_r($this->dbConnection->error(), true)); } return $result; }
/** * @param $table * @param $join * @param null $columns * @param null $where * @return array|bool */ public function select($table, $join, $columns = NULL, $where = NULL) { if (empty($this->_reader)) { return $this->_writer->select($table, $join, $columns, $where); } else { return $this->_reader->select($table, $join, $columns, $where); } }
function getResults($text, $index1, $index2) { include_once "medoo.min.php"; // Initialize medoo $database = new medoo(['database_type' => 'mysql', 'database_name' => 'anecdote_gimme', 'server' => '108.167.140.108', 'username' => 'anecdote_je', 'password' => 'hackChamps']); // get the categories $cats = $database->select("words", "category_id", ["name" => $text]); // select the results from the ids $results = array(); $results[] = $database->select("places", ["name", "address", "telephone", "website", "image", "category_id", "longitude", "latitude"], ["AND" => ["category_id" => $cats], "ORDER" => "description DESC", "LIMIT" => [$index1, $index2]]); /* * echo "<pre>"; * print_r($results); * echo "</pre>"; */ return $results; /* * $database->select ( "places", [ * "words" => ["words.category_id" => "places.category_id"], * "categories" => ["categories.id" => "words.category_id"] * ], [ * "places.name", * "places.address", * "places.telephone", * "categories.name" * ], [ * "words" => $text * ] ); */ /* * include_once 'mySQL_connection.php'; * * $req = $bdd->prepare ( "SELECT p.name, p.address, p.telephone, c.name * FROM places p * INNER JOIN words w ON w.category_id = p.category_id * INNER JOIN categories c ON c.id = w.category_id * WHERE w.name = :word" ); * $req->execute(array("word" => $text)); * $data = $req->fetch(); * $req->closeCursor(); * return json_encode ( $data ); */ }
/** *获得统计表部分数据 */ protected function get_all_data() { $medoo = new medoo(); $db = new maindb(); $counter = array(); if ($_SESSION['userinfo']['auth'] == 0) { $register_all = $db->count('p_user', array('uid'), array('uid[>]' => 0)); $authority_all = $db->count('p_user', array('auth'), array('auth' => 1)); $register_invite = $db->count('p_user', array('invite'), array('invite[!]' => '')); $authority_invite = $db->count('p_user', '*', array('AND' => array('invite[!]' => '', 'auth' => 1))); $counter = array('register_all' => $register_all, 'authority_all' => $authority_all, 'register_invite' => $register_invite, 'authority_invite' => $authority_invite, 'register_nature' => $register_all - $register_invite, 'authority_nature' => $authority_all - $authority_invite); } elseif ($_SESSION['userinfo']['auth'] == 1) { $counter = school_handler::manager_area_data_load($_SESSION['userinfo']['province']); } elseif ($_SESSION['userinfo']['auth'] == 2) { $counter = array('register_all' => 0, 'authority_all' => 0, 'register_invite' => 0, 'authority_invite' => 0, 'register_nature' => 0, 'authority_nature' => 0); } $this->assign('counter', $counter); //todo 根据身份推送不同的信息列表 //list数据获取 if ($_SESSION['userinfo']['auth'] == 0) { //管理员推送所有数据 $num = $medoo->count('ambassador', '*', array('auth[>]' => 0)); $list = $medoo->select('ambassador', '*', array('auth[>]' => 0, 'LIMIT' => 20)); } elseif ($_SESSION['userinfo']['auth'] == 1) { //省级主管,推送区域内数据 $num = $medoo->count('ambassador', '*', array('AND' => array('province' => $_SESSION['userinfo']['province'], 'auth' => 2))); $list = $medoo->select('ambassador', '*', array('AND' => array('province' => $_SESSION['userinfo']['province'], 'auth' => 2), 'LIMIT' => 20)); } elseif ($_SESSION['userinfo']['auth'] == 2) { $num = 1; $list = array(); } unset($medoo); unset($db); $this->data_package($list, $num); //填充欠缺数据,推送到前端 // $db=new maindb(); // $re=$db->select('p_user','*',array( // 'invite'=>$_SESSION['userinfo']['ekey'], // 'LIMIT'=>1, // )); }
static function through_area_get_school($area) { $redis = new Redis(); $redis->connect('127.0.0.1', 6379); $list = $redis->lRange($area, 0, 500); if (empty($list)) { $local = new medoo(); $list = $local->select('school', 'name', array('area' => $area)); unset($local); } unset($redis); return $list; }
/** * Verifies user login and logs in * returns false if invalid login details * else true */ public function user_login($username, $password) { $db = new medoo($this->config['db']); $result = $db->select('users', ['userid', 'password', 'type'], ['username' => $username]); if (count($result) == 0) { return False; } if (password_verify($password, $result[0]['password'])) { $_SESSION['userid'] = $result[0]['userid']; $_SESSION['user_type'] = $result[0]['type']; return True; } return False; }
/** * A wrapper for medoo select function * @param string $fields * @param array $where * @return array * @throws \Exception */ protected function getListQuery($fields = "*", $where = array()) { if (EMA_DEBUG && EMA_LOG_SQL_QUERIES) { $this->logSelectQuery($this->dbTable, $fields, $where); } $dbData = $this->dbConnection->select($this->dbTable, $fields, $where); if (is_array($dbData) === false) { $this->throwMysqlError(); } $parsedData = array(); foreach ($dbData as $record) { $record = $this->checkResult($record); $parsedData[] = $this->parseJson($record); } return $parsedData; }
protected function get_order_list() { $local = new medoo(); $remote = new maindb(); $list = $local->select('orders', '*', array('ekey' => $this->key)); if (!empty($list)) { foreach ($list as &$v) { $info = $remote->select('p_order', '*', array('id' => $v['order_id'])); //将unix时间戳转化为日期 $v['u_time'] = date('Y-m-d H:i:s', $v['u_time']); $v['c_time'] = date('Y-m-d H:i:s', $v['c_time']); if ($info[0]['did'] > 0) { $v['order_state'] = $this->state['-1']; } else { $v['order_state'] = $this->state[$info[0]['state']]; } } } $this->assign('list', $list); }
$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"]; } } } print_r(json_encode($data)); } } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n";
</head> <body> <div class="container"> <h1>SimplePoll</h1><br> <?php require "medoo.php"; require "vendor/autoload.php"; use Jenssegers\Optimus\Optimus; $optimus = new Optimus(1206616819, 2051302971, 838816212); $database = new medoo(); $getid = basename($_GET['q']); $pid = (int) base62decode($getid); echo '<img src="https://ga-beacon.appspot.com/UA-68001702-1/simplepoll/getpoll-' . $getid . '?pixel">'; $poll = $database->select("polls", ["title", "type", "botcheck", "ipcheck", "created"], ["id" => $pid]); $poll = $poll[0]; if (empty($poll['type'])) { die("<pre>\n███████╗██████╗ ██████╗ ██████╗ ██████╗ ██╗ ██╗ ██████╗ ██╗ ██╗\n██╔════╝██╔══██╗██╔══██╗██╔═══██╗██╔══██╗ ██║ ██║██╔═████╗██║ ██║\n█████╗ ██████╔╝██████╔╝██║ ██║██████╔╝ ███████║██║██╔██║███████║\n██╔══╝ ██╔══██╗██╔══██╗██║ ██║██╔══██╗ ╚════██║████╔╝██║╚════██║\n███████╗██║ ██║██║ ██║╚██████╔╝██║ ██║ ██║╚██████╔╝ ██║\n╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝\n\n██████╗ ██████╗ ██╗ ██╗ ███╗ ██╗ ██████╗ ████████╗ ███████╗ ██████╗ ██╗ ██╗███╗ ██╗██████╗\n██╔══██╗██╔═══██╗██║ ██║ ████╗ ██║██╔═══██╗╚══██╔══╝ ██╔════╝██╔═══██╗██║ ██║████╗ ██║██╔══██╗\n██████╔╝██║ ██║██║ ██║ ██╔██╗ ██║██║ ██║ ██║ █████╗ ██║ ██║██║ ██║██╔██╗ ██║██║ ██║\n██╔═══╝ ██║ ██║██║ ██║ ██║╚██╗██║██║ ██║ ██║ ██╔══╝ ██║ ██║██║ ██║██║╚██╗██║██║ ██║\n██║ ╚██████╔╝███████╗███████╗ ██║ ╚████║╚██████╔╝ ██║ ██║ ╚██████╔╝╚██████╔╝██║ ╚████║██████╔╝\n╚═╝ ╚═════╝ ╚══════╝╚══════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚═══╝╚═════╝\n</pre>"); } //grab poll data $results = $database->select("results", ["qid", "amount"], ["pid" => $pid]); $questions = $database->select("questions", ["qid", "text"], ["pid" => $pid]); //format questions foreach ($questions as &$quest) { $questdb[$quest['qid']]['text'] = $quest['text']; } //grab totals and add them to the questdb $totalvotes = 0; foreach ($results as &$rid) { $totalvotes += $rid['amount'];
/** * Created by BSMRSTU_warriors. * Date: 11/27/2015 * Time: 5:26 PM */ require 'medoo.php'; $database = new medoo(); if ($_SERVER['REQUEST_METHOD'] == 'POST') { if (isset($_POST['fullname']) && isset($_POST['phone']) && isset($_POST['district']) && isset($_POST['fulladdress']) && isset($_POST['pass'])) { $phone = $_POST['phone']; $fullname = $_POST['fullname']; $district = $_POST['district']; $address = $_POST['fulladdress']; $pass = $_POST['pass']; $image_path = 'files/img/blnk.png'; $is_phone_exists = $database->select("krishok", array("phone"), array("phone" => $phone)); print_r($is_phone_exists); echo '<br>'; if (count($is_phone_exists) == 0) { if (isset($_FILES['image'])) { $errors = array(); $file_name = $_FILES['image']['name']; $file_size = $_FILES['image']['size']; $file_tmp = $_FILES['image']['tmp_name']; $file_type = $_FILES['image']['type']; $file_ext = strtolower(end(explode('.', $_FILES['image']['name']))); $expensions = array("jpeg", "jpg", "png"); if (in_array($file_ext, $expensions) === false) { $errors[] = "extension not allowed, please choose a JPEG or PNG file."; } if ($file_size > 2097152) {
<tr> <th> 编号 </th> <th> 标题 </th> <th> 时间 </th> </tr> </thead> <tbody> <?php $list = $database->select("who", "qid", array("uid" => $_SESSION['uid'], "ORDER" => "id DESC")); for ($i = 0; $i < count($list); $i++) { $info = $database->select("question", array("id", "title", "time"), array("AND" => array("id" => $list[$i], "isanswer" => 0), "ORDER" => "time DESC")); if (count($info) > 0) { echo '<tr class="success">'; echo '<td>' . ($i + 1) . '</td>'; echo '<td><a href="answer.php?qid=' . $list[$i] . '">' . $info[0]['title'] . '</a></td>'; echo '<td>' . $info[0]['time'] . '</td>'; echo '</tr>'; } } ?> </tbody> </table> </div> </div>
<?php //include 'Insertdb2.php'; include "himpdf/mpdf.php"; require 'medoo.php'; require 'config.php'; print_r($_GET); $txnid = $_GET["txnid"]; $txnid = stripcslashes($txnid); $database = new medoo(['database_type' => 'mysql', 'database_name' => $dbname, 'server' => $servername, 'username' => $username, 'password' => $dbpassword]); $datas = $database->select("applicant", "*", ["txnid" => $txnid]); //print_r($datas); $message = file_get_contents('confirmaitonmail.php'); $message = str_replace("applicant_uname", $datas[0]['username'], $message); $message = str_replace("applicant_name", $datas[0]['applicant_name'], $message); $message = str_replace("applicant_email", $datas[0]['email'], $message); $message = str_replace("applicant_gname", $datas[0]['gname'], $message); $message = str_replace("applicant_presentadd", $datas[0]['presentadd'], $message); $message = str_replace("applicant_permanentadd", $datas[0]['permanentadd'], $message); $message = str_replace("applicant_phone", $datas[0]['mobile'], $message); $message = str_replace("applicant_dob", $datas[0]['dob'], $message); $message = str_replace("applicant_gender", $datas[0]['gender'], $message); $message = str_replace("applicant_cast", $datas[0]['cast'], $message); $message = str_replace("applicant_nationality", $datas[0]['nationality'], $message); $message = str_replace("applicant_postapplying", $datas[0]['postapplying'], $message); if ($datas[0]['cast'] == gen) { $amount = "200"; } else { $amount = "100"; } $message = str_replace("applicant_amount", $amount, $message);
<?php /* * 显示任务详情 * * */ header("Content-type:text/html; charset=utf8"); $id = $_POST['id']; include_once './medoo/medoo.php'; $database = new medoo(); $sql = $database->select("task", array("id", "time", "writer", "details", "timelong"), array("id" => $id)); if ($sql) { $result = array(); $result['state'] = "success"; $result['message'] = "get task success!"; $result['info'] = $sql; $result_json = json_encode($result); echo $result_json; } else { $result = array(); $result['state'] = "error"; $result['message'] = "get task error!select not work!"; $result_json = json_encode($result); echo $result_json; }
<?php /** * Created by PhpStorm. * User: zy * Date: 2015/11/3 * Time: 14:06 */ require_once '../../lib/medoo.php'; // Initialize $database = new medoo(['database_type' => 'mysql', 'database_name' => 'easycurd', 'server' => 'localhost', 'username' => 'root', 'password' => '', 'charset' => 'utf8']); $username = $_POST['username']; $password = $_POST['password']; echo $password; echo $username; $database->select('ec_user', ['name' => 'foo', 'email' => '*****@*****.**', 'age' => 25, 'lang' => ['en', 'fr', 'jp', 'cn']]); if ($result = $database) { //µÇ¼³É¹¦ session_start(); $_SESSION['username'] = $username; exit; } else { exit('µÇ¼ʧ°Ü£¡µã»÷´Ë´¦ <a href="javascript:history.back(-1);">·µ»Ø</a> ÖØÊÔ'); }
<?php require_once 'medoo.php'; require_once '../../php/inc.php'; $database = new medoo(['database_type' => 'mysql', 'database_name' => $DB, 'server' => $SERVIDOR, 'username' => $USUARIO, 'password' => $CLAVE, 'charset' => 'utf8']); $item = $_GET['item']; $tabla = $TABLA['usuarios']; $where = ['OR' => ['Nombre[~]' => $item, 'Cedula[~]' => $item]]; //$columnas['usuarios'] = ['id', 'Nombre', 'Cedula', 'Empresa', 'FechaReg', 'activo']; $columnas['usuarios'] = ['id', 'Nombre', 'Cedula', 'FechaReg', 'activo']; $data = $database->select($TABLA['usuarios'], $columnas['usuarios'], $where); foreach ($data as $llave => $valor) { $data[$llave]['Usuario'] = $data[$llave]['Cedula'] . ' ' . $data[$llave]['Nombre']; } echo json_encode($data, JSON_UNESCAPED_UNICODE);
<?php $cookie = json_decode($_POST['json']); define('__ROOT__', $_SERVER['DOCUMENT_ROOT']); require_once __ROOT__ . '/medoo.min.php'; require_once __ROOT__ . '/config.php'; $database = new medoo(array('database_type' => $config_db['database_type'], 'database_name' => $config_db['database_name'], 'server_name' => $config_db['server_name'], 'username' => $config_db['username'], 'password' => $config_db['password'], 'charset' => $config_db['charset'])); $arr = array(); foreach ($cookie as $val) { $arr[] = $database->select("catalog", array("[>]catecory" => array('category' => 'id')), array('catalog.id', 'catalog.name', 'catalog.chpu', 'catalog.price', 'catecory.chpu(cat_chpu)', 'catalog.image', 'catalog.local_price'), array("catalog.id" => $val->id)); } //print_r($arr); //делаем скидку для локалей require_once __ROOT__ . '/location/SxGeo.php'; $SxGeo = new SxGeo(__ROOT__ . '/location/SxGeo.dat'); $ip = $_SERVER['REMOTE_ADDR']; $city = $SxGeo->get($ip); $datas_disc = $database->select("location_discount", '*', array('city' => $city['city']['name_en'])); if (count($datas) == 0) { $datas_disc = $database->select("location_discount", '*', array('city' => 'Other')); } //учтем скидку вы цене товара foreach ($arr as &$val) { if ($val[0]['local_price'] == 1) { $val[0]['price'] = $val[0]['price'] - $datas_disc[0]['discount'] * $val[0]['price'] / 100; } } //print_r($datas_disc); //print_r($arr); $res = json_encode($arr); echo $res;
} require 'lib/medoo.php'; try { $database = new medoo(['database_type' => 'mysql', 'database_name' => 'secret_h', 'server' => 'localhost', 'username' => 'recipe', 'password' => 'mPu92jfqRJSVMa8H', 'charset' => 'utf8']); $method = ""; $user_id = $_SESSION['user_id']; if ($_GET != null) { $method = $_GET['method']; } else { if ($_POST != null) { $method = $_POST['method']; } } //print( $method ); if (strcmp($method, "checkUserName") == 0) { $data = $database->select("users", "user_name", ["user_name" => $_GET['user_name']]); print json_encode($data); } else { if ($method == "login") { $pw = sha1($_POST['password']); $uname = $_POST['user_name']; $data = $database->select("users", ["password", "user_name", "user_id"], ["user_name" => $uname]); if ($data[0]['password'] == $pw) { $data[0]['password'] = ""; print json_encode($data); $_SESSION['user_id'] = $data[0]['user_id']; } else { print json_encode([]); } } else { if ($method == "create") {
date_default_timezone_set("asia/shanghai"); include "../../medoo.php"; include '../../function.php'; $database = new medoo(['database_type' => 'mysql', 'database_name' => 'gongre', 'server' => 'localhost', 'username' => 'root', 'password' => 'xidryhm00', 'charset' => 'utf8', 'port' => 3306, 'option' => [PDO::ATTR_CASE => PDO::CASE_NATURAL]]); $action = ""; $act = ""; if ($_SERVER['REQUEST_METHOD'] === 'GET') { $action = htmlspecialchars($_GET["action"]); } if ($_SERVER['REQUEST_METHOD'] === 'POST') { $act = htmlspecialchars($_POST["act"]); } if ("login" === $action) { $opid = $_GET["username"]; $pw = $_GET["password"]; $data = $database->select("gr_op", "*", ["opid" => $opid]); if (count($data) > 0) { if ($data[0]["pw"] == $pw) { $_SESSION["opid"] = $opid; $_SESSION["opname"] = $data[0]["opname"]; $_SESSION["privilege"] = $data[0]["privilege"]; $_SESSION["currentYear"] = $database->select("gr_system", "CurrentYear")[0]; $_SESSION["baseScale"] = $database->select("gr_system", "BasePay")[0]; $_SESSION["changeStyle"] = ["所有变更", "变更名称", "变更地址", "变更缴费标准", "变更基本热费", "变更用热状态", "变更管理员", "变更面积", "变更备注"]; $_SESSION["allJianmian"] = $database->select("gr_jianmian_style", "*"); $_SESSION["allOP"] = $database->select("gr_op", "*"); $_SESSION["allManager"] = $database->select("gr_employee", "*"); $_SESSION["allStyle"] = $database->select("gr_style", "*"); header("location: ../../index.php"); } else { header("location: ../../login.php?error");
<?php /** * 获取留言对方姓名 * * */ header("Content-type:text/html; charset=utf8"); $id = $_POST['id']; include_once './medoo/medoo.php'; $database = new medoo(); $sql = $database->select("user", array("name"), array("id" => $id)); if ($sql) { $result['state'] = "success"; $result['message'] = "成功得到对方姓名"; $result['info'] = $sql; $result_json = json_encode($result); echo $result_json; } else { $result['state'] = "error"; $result['message'] = "获取对方姓名失败"; $result_json = json_encode($result); echo $result_json; }
* Date: 2015/7/1 * Time: 16:22 */ //todo,改变meting表中会议状态validity // todo,inform 中增加一项 //todo,1,attendence中检索meeting id,2,对应状态state设置为0 无效,3,对应user id写成新的notice,4,并将user表中的mes改为当前inform_id $mid = $_POST['id']; session_start(); $id = $_SESSION['uid']; include '../../parameter/Medoo/Resource/medoo.php'; //meeting $db = new medoo('meetingmanage'); $db->update('meeting', array('VALIDITY' => 1), array('MEETING_ID' => $mid)); // ////inform $re = $db->select('inform', 'CONTENT', array('MEETING_ID' => 40002)); $content = $re[0]; $new_mes = "注意:关于【" . $content . "】的会议已经取消,请您确认信息!"; $iid = $db->max('inform', 'INFORM_ID'); $iid += 1; $date = date("Y/m/d"); $db->insert("inform", array('INFORM_ID' => $iid, 'USER_ID' => $id, 'DATE' => $date, 'CONTENT' => $new_mes, 'MEETING_ID' => $mid)); //attendence //获得user列表 $users = $db->select('attendence', 'USER_ID', array('MEETING_ID' => 40000)); //跟新参会状态 $db->update('attendence', array('STATE' => 0), array('MEETING_ID' => $mid)); //notice & user $num = count($users); $nid = $db->max('notice', 'NOTICE_ID'); $nid += 1;
<?php require_once 'medoo.php'; $database = new medoo(array('database_type' => 'pgsql', 'database_name' => 'wid', 'server' => 'localhost', 'username' => 'wid_owner', 'password' => 'widowner', 'charset' => 'utf8', 'port' => 5432, 'prefix' => 'wid_schema.')); $data = $database->select("tblu_storage_view_vt", array('state', 'storage_name', 'city', 'drainage', 'data_provider_name', 'reporting_date', 'today_volume_active', 'today_capacity_active', 'today_proportion_full'), array('ORDER' => array('state ASC', 'storage_name ASC'))); echo '<pre>'; print_r($data); /* $database = new medoo( array( 'database_type' => 'pgsql', 'database_name' => 'dellstore2', 'server' => 'localhost', 'username' => 'postgres', 'password' => 'Jiqiang@1977', 'charset' => 'utf8', 'port' => 5432 ) ); echo '<pre>'; print_r($database->info()); $data1 = $database->select( // Table name. 'cust_hist', // Joins. array( '[><]customers' => 'customerid', '[><]products' => 'prod_id',
error_reporting(-1); ini_set('display_errors', 'On'); /** @var \Slim\Slim $app */ $app = new \Slim\Slim(['debug' => true]); /** @var medoo $database */ $database = new medoo(['database_type' => 'mysql', 'database_name' => 'toto', 'server' => '127.0.0.1', 'username' => 'root', 'password' => '', 'port' => 3306, 'charset' => 'utf8']); /** @var \Installer\Installer $installer */ $installer = new \Installer\Installer(['host' => '127.0.0.1', 'user' => 'root', 'db' => 'toto', 'pwd' => '']); $installer->init('0.2'); //Render header and body start. $app->render('head.phtml'); $app->render('top.phtml'); //Root route $app->get('/', function () use($database, $app) { $app->render('logo.phtml'); $posts = $database->select('posts', '*', ['ORDER' => 'id DESC']); // $app->render('static.phtml'); if ($posts) { foreach ($posts as $post) { $app->render('banner.phtml', ['id' => $post['id'], 'title' => $post['title'], 'language' => $post['language'], 'content' => $post['content'], 'time' => $post['time_posted']]); } return true; } $app->redirect('page/fourohfour', 404); }); //Specific post, either by ID or SEO url. $app->get('/:id', function ($id) use($database, $app) { $app->render('logo.phtml'); if ((int) $id !== 0) { $post = $database->select('posts', '*', ['id[=]' => (int) $id]); } else {
<?php $app->get('/admin', function () use($app) { global $dbCredentials; $database = new medoo($dbCredentials); $invoices = $database->select("invoice", ["id", "modified", "currency", "company", "name", "address", "type"], ["ORDER" => "modified DESC"]); foreach ($invoices as $id => $invoice) { $invoices[$id]['lines'] = $database->select("line", ["id", "description", "charge", "quantity", "is_hours"], ["invoice_id" => $invoice['id'], "ORDER" => "id ASC"]); } $app->render('admin/admin.html.twig', ['invoices' => $invoices]); })->setName('home');
require_once BASE_PATH . '/medoo.min.php'; require_once BASE_PATH . '/login_handler.php'; require_once BASE_PATH . '/components/nav.php'; /* Login handling and permission check */ $login = new loginHandler($config); if (!$login->is_logged_in()) { $login->redirect_login('Please login'); } if ($login->get_user_type() != 'admin') { $login->not_authorized_error(); } //get course list from db $db = new medoo($config['db']); $courses = $db->select('courses', ['code', 'name', 'instructor']); //populate extra required data foreach ($courses as $key => $course) { $result = $db->select('profs', ['name'], ['userid' => $courses[$key]['instructor']]); $courses[$key]['instructor'] = $result[0]['name']; } ?> <!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>Student Course Dashboard</title>