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


PHP medoo::count方法代码示例

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


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

示例1: count

 /**
  * @param      $table
  * @param null $where
  * @return int
  */
 public function count($table, $where = NULL)
 {
     if (empty($this->_reader)) {
         return $this->_writer->count($table, $where);
     } else {
         return $this->_reader->count($table, $where);
     }
 }
开发者ID:dalinhuang,项目名称:StudentManage,代码行数:13,代码来源:sql.php

示例2: login

 function login()
 {
     if (session_id() == '') {
         session_start();
     }
     if (isset($_POST["mail"]) & isset($_POST["password"]) & isset($_POST["cre"])) {
         if ($_POST["mail"] != "" and $_POST["password"] != "" and $_POST["cre"] != "") {
             $mail = $_POST["mail"];
             $password = $_POST["password"];
             $role = $_POST["cre"];
             require_once 'SessionManager.php';
             $session_manager = new SessionManager();
             require_once 'medoo.min.php';
             $database = new medoo();
             $count = $database->count("triotrack_users", ["email" => "{$mail}"]);
             if ($count > 0) {
                 $profile = $database->get("triotrack_users", ["username", "password", "salt", "client"], ["email" => "{$mail}"]);
                 if ($role === "admin") {
                     if ($profile["password"] === sha1($password . $profile["salt"])) {
                         $username = $profile["username"];
                         $client = $profile["client"];
                         $cookie = array("email" => "{$mail}", "username" => "{$username}", "password" => "{$password}", "client" => "{$client}", "role" => "{$role}");
                         $encoded_cookie = $session_manager->encode_session(json_encode($cookie));
                         $_SESSION["user_id"] = $encoded_cookie;
                         setcookie("user_id", $encoded_cookie, time() + 86400 * 1, "/");
                         // 86400 = 1 day
                         echo "admin";
                         exit;
                     } else {
                         echo "failed";
                         exit;
                     }
                 } else {
                     if ($profile["client"] === $password) {
                         $username = $profile["username"];
                         $client = $profile["client"];
                         $cookie = array("email" => "{$mail}", "username" => "{$username}", "password" => "{$password}", "client" => "{$client}", "role" => "{$role}");
                         $encoded_cookie = $session_manager->encode_session(json_encode($cookie));
                         $_SESSION["user_id"] = $encoded_cookie;
                         setcookie("user_id", $encoded_cookie, time() + 86400 * 1, "/");
                         // 86400 = 1 day
                         echo "client";
                         exit;
                     } else {
                         echo "failed";
                         exit;
                     }
                 }
             }
         } else {
             echo "failed";
         }
         exit;
     }
 }
开发者ID:venusdharan,项目名称:Codex-PHP-Framework,代码行数:55,代码来源:AuthenticationManager.php

示例3: medoo

    }
    if (!preg_match("/^[0-9a-zA-ZÄÜÖ_.-]+@[0-9a-z.-]+\\.[a-z]{2,6}\$/", $email)) {
        $fehler['email'] = "<font color=#cc3333>Please enter a <strong>e-mail-address</strong>.\n<br /></font>";
    }
    if (!$password) {
        $fehler['password'] = "<font color=#cc3333>Please enter your Password.\n<br /></font>";
    }
    if (strlen($password) < 8) {
        $fehler['password'] = "<font color=#cc3333>Password too short.\n<br /></font>";
    }
    if ($repassword != $password) {
        $fehler['repassword'] = "<font color=#cc3333>The pasword is not matching.\n<br /></font>";
    }
    $database = new medoo(['database_type' => 'mysql', 'database_name' => $dbname, 'server' => $servername, 'username' => $username, 'password' => $dbpassword]);
    //$datas = $database->select("tmpapplicant", "*");
    $countuser = $database->count("applicant", ["username" => $name]);
    if ($countuser > 0) {
        $fehler['name'] = "<font color=#cc3333><strong>User Name</strong> already exists..<br /></font>";
    }
    $countemail = $database->count("tmpapplicant", ["email" => $email]);
    if ($countemail > 0) {
        $fehler['email'] = "<font color=#cc3333><strong>e-mail-address</strong> already exists.\n<br /></font>";
    }
    if (!isset($fehler)) {
        //echo "done";
        //include("validatelogin.php");
        $action = "upload.php";
        $passwordhash = md5($password);
    }
}
?>
开发者ID:Himadri1800,项目名称:begc-gateway,代码行数:31,代码来源:login.php

示例4: medoo

 * Date: 02.02.2016
 * Time: 23:38
 */
require_once 'vendor/autoload.php';
//open database connection
$database = new medoo(['database_type' => 'mysql', 'database_name' => 'r8db', 'server' => '172.16.2.109', 'username' => 'admin', 'password' => 'admin', 'charset' => 'utf8']);
$user_id = $database->select("user", ["[>]entry" => "user_id"], ["entry.entry_id"], ["entry_id" => 10]);
$user = $database->get('user', ['[>]entry' => "user_id"], ['user_id', 'email', 'username', 'admin', 'nsfw'], ['entry_id' => 10]);
$html = '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"><div class="container"><div class="row">';
$html .= '<form class="clearfix" method="get">
<div class="form-group col-sm-4"><label for="action">Action</label><select class="form-control" name="action" id="action"><option value="show">show</option><option value="delete">delete</option><option value="add">add</option><option value="set">set</option></select></div>
<div class="form-group col-sm-4"><label for="amount">Amount</label><input class="form-control" type="number" name="amount" id="amount" value=""></div>
<div class="form-group col-sm-4"><label>Functions</label><div><button type="submit" class="btn btn-primary">Submit</button> <button type="reset" class="btn btn-warning">Reset</button></div></div>
</form>';
$html .= '</div><div class="row"><div class="col-sm-12">';
$count = $database->count('entry');
$database->query('ALTER TABLE "entry" AUTO_INCREMENT = ' . ($count + 1));
if (isset($_GET['action'])) {
    $amount = isset($_GET['amount']) && is_numeric($_GET['amount']) ? intval($_GET['amount']) : 100;
    if ($_GET['action'] == 'delete' && $count != 0) {
        $database->delete('entry', ['ORDER' => 'entry_id DESC', 'LIMIT' => $amount]);
    } elseif ($_GET['action'] == 'delete') {
        $html .= 'Where nothing is, nothing can be removed.';
    } elseif ($_GET['action'] == 'add') {
        for ($i = $count + 1; $i < $count + $amount + 1; ++$i) {
            $data = ['user_id' => 1, 'category_id' => 1, 'title' => 'Dummy #' . $i, 'desc' => 'Lorem Ipsum', 'image' => 'https://placehold.it/400x400'];
            $database->insert('entry', $data);
        }
    } elseif ($_GET['action'] == 'set') {
        $database->delete('entry', ['LIMIT' => 99999999999999]);
        $count = $database->count('entry');
开发者ID:thedodobird2,项目名称:M307,代码行数:31,代码来源:entryDB.php

示例5: tempopomeriggio

/**
 * Controlla che sia ancora possibile iscriversi all'aula studio
 * 
 * @param medoo $database Connessione con il database
 * @param int $id
 * @return boolean
 */
function tempopomeriggio($database, $id)
{
    return $database->count("aule", array("AND" => array("id" => $id, "#data[>]" => "NOW()"))) != 0;
}
开发者ID:Dasc3er,项目名称:Sito-studentesco,代码行数:11,代码来源:default.php

示例6: count

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

示例7: getNumOfRows

 /**
  * Return the number of rows in the table
  * @param string $where
  * @param bool $extCall
  * @return bool|int
  * @throws FatalError
  */
 public function getNumOfRows($where = '', $extCall = false)
 {
     $this->gp->checkAccess(__FUNCTION__, $extCall);
     return $this->dbConnection->count($this->dbTable, $where);
 }
开发者ID:indiwine,项目名称:EMA-engine,代码行数:12,代码来源:RootClass.php

示例8: array

$app = new \Slim\Slim(array('view' => new \Slim\Views\Twig()));
$app->view()->parserExtensions = array(new \Slim\Views\TwigExtension());
$database = new medoo($config['database']);
/*
 * Go away message for stray users
 */
$app->get('/', function () {
    echo 'This is the validation endpoint for the womath research project.';
    echo 'You need to use the link in the email to validate.';
})->name('root');
/*
 * Validation endpoints
 */
$app->get('/:uuid/correct', function ($uuid) use($app, $database) {
    // ID must exist
    if ($database->count('people', ['uuid' => $uuid]) !== 1) {
        return $app->render('error.twig');
    }
    // Mark entry as correct
    $database->update('people', ['validation' => 'correct'], ['uuid' => $uuid]);
    // Say thank you
    $company = $database->select('people', ['company_name'], ['uuid' => $uuid])[0]['company_name'];
    return $app->render('correct.twig', ['company' => $company, 'uuid' => $uuid]);
})->name('correct');
$app->get('/:uuid/wrong', function ($uuid) use($app, $database) {
    // ID must exist
    if ($database->count('people', ['uuid' => $uuid]) !== 1) {
        return $app->render('error.twig');
    }
    // Mark entry as wrong
    $database->update('people', ['validation' => 'wrong'], ['uuid' => $uuid]);
开发者ID:jakobbuis,项目名称:womath_validator,代码行数:31,代码来源:index.php

示例9: medoo

<?php

/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/7/8
 * Time: 16:18
 */
require_once '../../parameter/Medoo/Resource/medoo.php';
$mydb = new medoo('meetingmanage');
$num = $mydb->count('update');
$id = 90000 + $num;
$mydb->insert('update', array('ID' => $id, 'DATE' => date('Y/m/d')));
//获得room id 全部
$arr_id = $mydb->select('rooms', 'ROOM_ID', array('STATE[!]' => 0));
$num_id = count($arr_id);
//var_dump($arr_id);
//
//循环滚动{
for ($i = 0; $i < $num_id; $i++) {
    $sta = $mydb->select('rooms', array('ONE1', 'ONE2', 'ONE3', 'ONE4', 'ONE5', 'ONE6', 'TWO1', 'TWO2', 'TWO3', 'TWO4', 'TWO5', 'TWO6', 'THREE1', 'THREE2', 'THREE3', 'THREE4', 'THREE5', 'THREE6'), array('ROOM_ID' => $arr_id[$i]));
    $state = $sta[0];
    echo $state['TWO1'];
    $mydb->update('rooms', array('ONE1' => $state['TWO1'], 'ONE2' => $state['TWO2'], 'ONE3' => $state['TWO3'], 'ONE4' => $state['TWO4'], 'ONE5' => $state['TWO5'], 'ONE6' => $state['TWO6'], 'TWO1' => $state['THREE1'], 'TWO2' => $state['THREE2'], 'TWO3' => $state['THREE3'], 'TWO4' => $state['THREE4'], 'TWO5' => $state['THREE5'], 'TWO6' => $state['THREE6'], 'THREE1' => 0, 'THREE2' => 0, 'THREE3' => 0, 'THREE4' => 0, 'THREE5' => 0, 'THREE6' => 0), array('ROOM_ID' => $arr_id[$i]));
}
开发者ID:keensting,项目名称:MeetingManageSystem,代码行数:25,代码来源:ajax_scroll_database.php

示例10: controleer_email

function controleer_email($email)
{
    $database = new medoo();
    $emailExists = $database->count("gebruikers", ["AND" => ["email" => $email]]);
    /* If exectly one user has been found */
    if ($emailExists == 1) {
        return false;
    } else {
        return true;
    }
}
开发者ID:MartijnEngelen,项目名称:WedstrijdTest,代码行数:11,代码来源:functies.php

示例11: medoo

if (isset($_SESSION['isLoggedIn'], $_SESSION['email']) && $_SESSION['isLoggedIn'] == "true") {
    $user = $database->get("gebruikers", "*", ["AND" => ["email" => $_SESSION['email']]]);
    //print_r($user);
    include 'assets/html/nav.html';
    include 'assets/html/login_success.html';
    include 'phpAPI/home.php';
    //header("Location: /wedstrijdplatform/#/spelpagina"); //dit mag hier niet, zorgt voor eindeloze redirect ( na post ziet hij dat er al een sessie is dus komt hij hier en gaat hij nogmaals doorverwijzen
    //naar spelpagina, en dit blijft zich herhalen, dit stond hier omdat je als je al ingelogd bent, dat je automatisch de spelpagina ziet en niet opnieuw moet inloggen)
    include "assets/html/footer.html";
    //session_destroy(); //moet weg, staat hier enkel voor test
} else {
    if (isset($_POST['inputEmail'], $_POST['inputPassword'])) {
        $database = new medoo();
        $email = trim($_POST['inputEmail']);
        /* Check for correct email and password */
        $emailExists = $database->count("gebruikers", ["AND" => ["email" => $email]]);
        /* If exectly one user has been found */
        if ($emailExists == 1) {
            $enteredPassword = trim($_POST['inputPassword']);
            $user = $database->get("gebruikers", "*", ["AND" => ["email" => $email]]);
            //print_r($user);
            $dbpassword = $user['wachtwoord'];
            if (password_verify($enteredPassword, $dbpassword)) {
                $_SESSION['email'] = $email;
                $_SESSION['isLoggedIn'] = "true";
                /*include 'html/nav.html';
                		echo "<h1>User was get from post!</h1>"; /////////////////////////////////delete
                		include 'html/login_success.html';
                		echo "<h1>Normal user logged in.</h1>";
                		include 'php/home.php';*/
                header("Location: /wedstrijdplatform/#/spelpagina");
开发者ID:EuroGijbelsPXL,项目名称:Wedstrijdplatform,代码行数:31,代码来源:index.php

示例12: get_self_counter

 /**
  *获得自身的注册数和认证数&订单数,如果我是主管,将学校列表写入session
  */
 protected function get_self_counter()
 {
     $local = new medoo();
     $db = new maindb();
     $register = $db->count('p_user', '*', array('invite' => $_SESSION['userinfo']['ekey']));
     $authority = $db->count('p_user', '*', array('AND' => array('invite' => $_SESSION['userinfo']['ekey'], 'auth' => 1)));
     $orders = $local->count('orders', '*', array('ekey' => $_SESSION['userinfo']['ekey']));
     unset($db);
     unset($local);
     if ($_SESSION['userinfo']['auth'] == 1) {
         //主管,写入学校列表
         $_SESSION['school'] = school_handler::through_area_get_school($_SESSION['userinfo']['province']);
     }
     $_SESSION['userinfo']['register'] = $register;
     $_SESSION['userinfo']['authority'] = $authority;
     $_SESSION['userinfo']['orders'] = $orders;
 }
开发者ID:keensting,项目名称:ErhuoAmbass,代码行数:20,代码来源:main.php

示例13: json_encode

/**
 * Created by PhpStorm.
 * User: KeenSting
 * Date: 2015/10/15
 * Time: 17:09
 */
require_once '../../../medoo/medoo.php';
require_once '../../../medoo/maindb.php';
$type = $_POST['type'];
$begin = ($_POST['index'] - 1) * 20;
$local = new medoo();
$remote = new maindb();
//管理员查全部的
if ($type == 'admin') {
    $re = $local->select('ambassador', '*', array('auth[>]' => 0, 'LIMIT' => [$begin, 20]));
} elseif ($type == 'manager') {
    $province = $_POST['province'];
    $re = $local->select('ambassador', '*', array('AND' => array('province' => $province, 'auth' => 2), 'LIMIT' => [$begin, 20]));
}
//统一去远端数据库匹配数据
foreach ($re as &$v) {
    $reg = $remote->count('p_user', '*', array('invite' => $v['ekey']));
    $aut = $remote->count('p_user', '*', array('AND' => array('invite' => $v['ekey'], 'auth' => 1)));
    $orders = $local->count('orders', '*', array('ekey' => $v['ekey']));
    $v['reg'] = $reg;
    $v['aut'] = $aut;
    $v['ord'] = $orders;
}
unset($remote);
unset($local);
echo json_encode(array('index' => $_POST['index'], 'list' => $re));
开发者ID:keensting,项目名称:ErhuoAmbass,代码行数:31,代码来源:main_page.php

示例14: array

        echo 'error';
    } else {
        if ($re[0]['province'] != $_SESSION['userinfo']['province'] && $_SESSION['userinfo']['auth'] == 1) {
            echo 'unauthrized';
            exit;
        }
        //key拥有者所在学校的数据
        $reg = $remote->count('p_user', '*', array('school' => $re[0]['school']));
        $aut = $remote->count('p_user', '*', array("AND" => array('school' => $re[0]['school'], 'auth' => 1)));
        $reg_in = $remote->count('p_user', '*', array("AND" => array('school' => $re[0]['school'], 'invite[!]' => '')));
        $aut_in = $remote->count('p_user', '*', array("AND" => array('school' => $re[0]['school'], 'invite[!]' => '', 'auth' => 1)));
        $school_data = array('reg' => $reg, 'aut' => $aut, 'reg_in' => $reg_in, 'aut_in' => $aut_in, 'reg_na' => $reg - $reg_in, 'aut_na' => $aut - $aut_in);
        $re[0]['reg'] = $remote->count('p_user', '*', array('AND' => array('invite' => $re[0]['ekey'], 'reg_time[>]' => $begin, 'reg_time[<]' => $end)));
        $re[0]['aut'] = $remote->count('p_user', '*', array('AND' => array('invite' => $re[0]['ekey'], 'auth_time[>]' => $begin, 'auth' => 1, 'auth_time[<]' => $end)));
        $re[0]['my_auth'] = $_SESSION['userinfo']['auth'];
        $re[0]['ord'] = $local->count('orders', '*', array('AND' => array('ekey' => $re[0]['ekey'], 'u_time[>]' => $begin, 'u_time[<]' => $end)));
        echo json_encode(array('info' => $re[0], 'data' => $school_data));
    }
    exit;
} elseif ($type == 'school') {
    //按照学校查询
    $name = $_POST['name'];
    $begin = $_POST['begin'];
    $end = $_POST['end'];
    if ($_SESSION['userinfo']['auth'] == 2) {
        $name = $_SESSION['userinfo']['school'];
    }
    if ($_SESSION['userinfo']['auth'] == 1 && !in_array($name, $_SESSION['school'])) {
        echo 'noschool';
        exit;
    }
开发者ID:keensting,项目名称:ErhuoAmbass,代码行数:31,代码来源:data_match.php

示例15: array

//查询一次远端数据库,匹配订单状态
$item = $remote->select('p_order', '*', array('id' => $id));
if (empty($item)) {
    echo 'noinfo';
} elseif ($item[0]['state'] < 2) {
    echo 'unfinish';
} else {
    //todo
    //可能会添加几个大使开放所有订单种类
    $sid = $item[0]['sid'];
    $sell_info = $remote->select('p_sell_goods', 'ccid', array('id' => $sid));
    $ccid = $sell_info[0];
    if ($ccid != 100) {
        echo 'type';
        exit;
    }
    $check = $local->count('orders', '*', array('order_id' => $id));
    if ($check == 1) {
        echo 'repeat';
        exit;
    }
    $re = $local->insert('orders', array('ekey' => $_SESSION['userinfo']['ekey'], 'state' => 0, 'price' => $item[0]['price'], 'u_time' => time(), 'c_time' => $item[0]['time'], 'order_id' => $id, 'type' => 0, 'act_id' => 0));
    if ($re != 0) {
        echo 'ok';
    } else {
        echo 'error';
    }
    //todo 写
    //入本地
}
//print_r($item);
开发者ID:keensting,项目名称:ErhuoAmbass,代码行数:31,代码来源:add_order_number.php


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