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


PHP sql::get方法代码示例

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


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

示例1: loginPost

 protected static function loginPost()
 {
     $email = type::post('email', 'string');
     $password = type::post('password', 'string');
     $remember = type::post('remember', 'int');
     if (is_null($email) || is_null($password) || $email == '' || $password == '') {
         echo message::info(lang::get('fill_out_both'));
         return;
     }
     $sql = new sql();
     $sql->query('SELECT password, salt, id FROM ' . sql::table('user') . ' WHERE `email` = "' . $sql->escape($email) . '"');
     if (!$sql->num()) {
         echo message::danger(sprintf(lang::get('email_not_found'), htmlspecialchars($email)), true);
         $shake = 1;
         return;
     }
     $sql->result();
     if (!self::checkPassword($password, $sql->get('salt'), $sql->get('password'))) {
         echo message::danger(lang::get('wrong_pw'));
         $shake = 1;
         return;
     }
     self::loginSession();
     self::$userID = $sql->get('id');
     $_SESSION['login'] = $sql->get('id');
     if ($remember) {
         setcookie("remember", $sql->get('id'), time() + 3600 * 24 * 7);
     }
 }
开发者ID:DINKIN,项目名称:rokket,代码行数:29,代码来源:login.php

示例2: getAll

 public static function getAll()
 {
     if (!count(self::$all)) {
         $sql = new sql();
         $sql->query('SELECT name FROM ' . sql::table('addons') . ' WHERE `install` = 1  AND `active` = 1')->result();
         while ($sql->isNext()) {
             self::$all[] = $sql->get('name');
             $sql->next();
         }
     }
     return self::$all;
 }
开发者ID:DINKIN,项目名称:rokket,代码行数:12,代码来源:config.php

示例3: News

<?php

/**
 * Created by PhpStorm.
 * User: Alex Sandiyarov
 * Date: 13.12.15
 * Time: 12:17
 */
$news = new News();
$a = $news->getAll();
var_dump($a);
//$news->add($data);
//$news->update($title2, $id);
$a = new sql();
$a->get('*', 'news', 'ORDER BY date DESC');
print_r($a->packToArray());
print_r($a->get('*', 'news', 'WHERE  id = 4'));
$a->insert('news', 'id, title', '"34543435434534353453455", "sadsadas"');
$a->update('news', 'title = "KUKU"', '4');
开发者ID:Alex4S,项目名称:beta,代码行数:19,代码来源:index.php

示例4: getOne

 public function getOne($id)
 {
     $sql = new sql();
     return $sql->get('*', 'news', 'WHERE  id = ' . $id);
 }
开发者ID:Alex4S,项目名称:beta,代码行数:5,代码来源:news.php

示例5: foreach

     foreach ($perms as $key => $val) {
         foreach ($val as $var) {
             $rights[] = $key . '[' . $var . ']';
         }
     }
     $sql = new sql();
     $sql->setTable('user');
     $sql->setWhere('id=' . $id);
     $admin = isset($_POST['admin']) ? 1 : 0;
     $sql->addPost('perms', implode('|', $rights));
     $sql->addPost('firstname', type::post('firstname'));
     $sql->addPost('name', type::post('name'));
     $sql->addPost('email', type::post('email'));
     $sql->addPost('admin', $admin);
     $sql->addPost('username', type::post('username'));
     if (type::post('password') && type::post('password') != $sqlUser->get('password')) {
         $sql->addPost('password', userLogin::hash(type::post('password'), $sqlUser->get('salt')));
     }
     $sql->update();
     echo message::success(lang::get('user_edited'));
 }
 $sql = new sql();
 $sql->result("SELECT * FROM " . sql::table('user') . " WHERE id = '" . $sql->escape($id) . "'");
 $permTypes = ['server', 'games', 'user'];
 $perms = explode('|', $sql->get('perms'));
 $permsSplit = [];
 foreach ($perms as $value) {
     preg_match("~^(\\w+)\\[(\\w+)\\]\$~", $value, $matches);
     if (count($matches)) {
         $key = $matches[1];
         if (!isset($permsSplit[$key])) {
开发者ID:DINKIN,项目名称:rokket,代码行数:31,代码来源:user.php

示例6: sortTable

 public static function sortTable($table, $sort, $where = '', $select = ['id', 'sort'])
 {
     if ($where) {
         $where = ' WHERE ' . $where;
     }
     $update = new sql();
     $update->setTable($table);
     $i = 1;
     $sql = new sql();
     $sql->query('SELECT `' . $select[0] . '`, `' . $select[1] . '` FROM ' . self::table($table) . $where . ' ORDER BY `' . $select[1] . '` ASC')->result();
     while ($sql->isNext()) {
         if ($sort == $i) {
             $i++;
         }
         $update->addPost($select[1], $i);
         $update->setWhere($select[0] . '=' . $sql->get($select[0]));
         $update->update();
         $sql->next();
         $i++;
     }
 }
开发者ID:DINKIN,项目名称:rokket,代码行数:21,代码来源:sql.php


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