max() public method

public max ( $table, $join, $column = null, $where = null )
Ejemplo n.º 1
0
 /**
  * @param      $table
  * @param      $column
  * @param null $where
  * @return int
  */
 public function max($table, $column, $where = NULL)
 {
     if (empty($this->_reader)) {
         return $this->_writer->max($table, $column, $where);
     } else {
         return $this->_reader->max($table, $column, $where);
     }
 }
//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;
for ($i = 0; $i < $num; $i++) {
    $db->insert('notice', array('NOTICE_ID' => $nid, 'USER_ID' => $users[$i], 'INFORM_ID' => $iid, 'STATE' => 0));
    $db->update('user', array('MES' => $iid), array('USER_ID' => $users[$i]));
<?php

/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/7/8
 * Time: 12:30
 */
include './parameter/Medoo/Resource/medoo.php';
$num = $_POST['num'];
$space = $_POST['space'];
$ppt = $_POST['ppt'];
$mic = $_POST['mic'];
$board = $_POST['board'];
$mydb = new medoo('meetingmanage');
$id = $mydb->max('rooms', 'ROOM_ID');
$mydb->insert('rooms', array('ROOM_ID' => $id + 1, 'NUM' => $num, 'SPACE' => $space, 'ONE1' => 0, 'ONE2' => 0, 'ONE3' => 0, 'ONE4' => 0, 'ONE5' => 0, 'ONE6' => 0, 'TWO1' => 0, 'TWO2' => 0, 'TWO3' => 0, 'TWO4' => 0, 'TWO5' => 0, 'TWO6' => 0, 'THREE1' => 0, 'THREE2' => 0, 'THREE3' => 0, 'THREE4' => 0, 'THREE5' => 0, 'THREE6' => 0, 'MIC' => $mic, 'PPT' => $ppt, 'BOARD' => $board, 'STATE' => 1));
?>
<html>
<head>

</head>
<body style="background-color: #ffffff;">
<script>
    alert('新的会议室已添加!');
</script>
</body>
<meta http-equiv="refresh" content="1;url='./meetingroom.php'">

</html>
/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/7/8
 * Time: 11:53
 */
require_once './parameter/Medoo/Resource/medoo.php';
$name = $_POST['name'];
$sex = $_POST['sex'];
$dep = $_POST['depart'];
$pos = $_POST['position'];
$tel = $_POST['tel'];
$mail = $_POST['mail'];
$mydb = new medoo('meetingmanage');
$id = $mydb->max('user', 'USER_ID');
$mydb->insert('user', array('USER_ID' => $id + 1, 'EMAIL' => $mail, 'PHONE' => $tel, 'NAME' => $tel, 'REAL_NAME' => $name, 'PWD' => $tel, 'IDENTY' => $pos, 'HEAD_IMG' => './assert/user/headimg/4.jpg', 'SEX' => $sex, 'DEPART_ID' => $dep, 'STATE' => 1, 'MES' => 0));
?>
<html>
<head>

</head>
    <body>
        <script>
            alert('员工信息已添加,手机号即为登录账号和密码!');
        </script>
    </body>
    <meta http-equiv="refresh" content="1;url='./addperson.php'">

</html>
Ejemplo n.º 5
0
<?php

ini_set('odbc.defaultlrl', '1024000');
require 'conf.php';
for ($i = 0; $i <= 200; $i++) {
    $newmysqldb = new medoo(['server' => '127.0.0.1', 'username' => 'root', 'password' => '', 'database_name' => 'lianchuangcms', 'port' => 3306]);
    $maxid = $newmysqldb->max('news', 'id');
    $maxid == false && ($maxid = 0);
    //文章表
    $sql = 'SELECT TOP(5000) ID,ClassID,Title,keyword,OrderID,Attribute,UserID,CreateDate,UpdateDate,CONVERT(text,Content) as Content,DefaultPic,FromWeb,filename FROM Word where ID >' . $maxid . ' ORDER BY ID ASC';
    $exec = odbc_exec($mssqldb, $sql);
    while ($row = odbc_fetch_array($exec)) {
        $content = trim(mb_convert_encoding(trim($row['Content']), "UTF-8", "GBK"));
        $insertid = $newmysqldb->insert('news', ['id' => str_replace('.0', '', $row['ID']), 'catid' => str_replace('.0', '', $row['ClassID']), 'title' => trim(str_replace("&nbsp;", '', remove_nbsp(mb_convert_encoding($row['Title'], "UTF-8", "GBK")))), 'keywords' => trim(remove_nbsp(mb_convert_encoding($row['keyword'], "UTF-8", "GBK"))), 'description' => trim(str_replace("&nbsp;", '', remove_nbsp(mb_substr(strip_tags($content), 0, 78, 'UTF-8')))), 'listorder' => str_replace('.0', '', $row['OrderID']), 'attribute' => intval($row['Attribute']), 'uid' => str_replace('.0', '', $row['UserID']), 'username' => '', 'url' => '', 'islink' => 0, 'inputtime' => strtotime($row['CreateDate']), 'updatetime' => strtotime($row['UpdateDate']), 'status' => 99]);
        $newmysqldb->insert('news_data', ['id' => str_replace('.0', '', $row['ID']), 'content' => addslashes(stripslashes($content)), 'defaultpic' => $row['DefaultPic'], 'fromweb' => $row['FromWeb'], 'filename' => $row['filename']]);
        echo 'insert article success id is ' . $row['ID'] . PHP_EOL;
    }
}
function remove_nbsp($str)
{
    $str = mb_ereg_replace('^( | )+', '', $str);
    $str = mb_ereg_replace('( | )+$', '', $str);
    $str = mb_ereg_replace('  ', "\n  ", $str);
    $order = array("\r\n", "\n", "\r");
    $replace = '<br/>';
    $str = str_replace($order, $replace, $str);
    return $str;
}
Ejemplo n.º 6
0
} else {
    if (file_exists("assert/docs/" . $_FILES["file"]["name"])) {
        echo $_FILES["file"]["name"] . " already exists. ";
    } else {
        $name = $_FILES['file']['name'];
        $path = "./assert/docs/" . $_FILES["file"]["name"];
        move_uploaded_file($_FILES["file"]["tmp_name"], "assert/docs/" . $_FILES["file"]["name"]);
    }
}
//}
//else{
//    echo "文件不合法!";
//}
$type = $_POST['type'];
$db = new medoo('meetingmanage');
$did = $db->max('docspace', 'DOC_ID');
$did += 1;
$db->insert('docspace', array('DOC_ID' => $did, 'MEETING_ID' => $mid, 'TYPE' => $type, 'DATE' => date("Y/m/d"), 'PATH' => $path, 'NAME' => $name));
?>
<html>
<head>

</head>
<body style="background:#ffffff">
<script type="text/javascript">
    alert('文件上传成功!')

</script>
    <meta http-equiv="refresh"  content="100;url='./mymeeting.php'"/>

</body>
Ejemplo n.º 7
0
                return true;
            }
        }
    </script>
    <?php 
include './parameter/Medoo/Resource/medoo.php';
$name = '';
$describe = '';
$phone = '';
if (!$_POST) {
} else {
    $db = new medoo('meetingmanage');
    $name = $_POST['name'];
    $phone = $_POST['phone'];
    $describe = $_POST['info'];
    $did = $db->max('departs', 'DEPART_ID');
    $did += 1;
    //depart id
    $db->insert('departs', array('DEPART_ID' => $did, 'NAME' => $name, 'PHONE' => $phone, 'INSTRUCTION' => $describe));
    ?>
        <script>
            alert("添加成功!");
            document.location.href='./addDepart.php';
        </script>
    <?php 
}
?>
</head>
<body>
    <div class="container">
        <div class="page-header">
Ejemplo n.º 8
0
/**
 * Controlla se l'utente è inserito in una classe
 * 
 * @param medoo $database Connessione con il database
 * @param int $user Identificativo dell'utente da considerare
 * @return boolean
 */
function classe($database, $user)
{
    return $database->count("studenti", array("AND" => array("id" => $database->max("studenti", "id"), "persona" => $user))) != 0;
}