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


PHP Sql::fetch方法代码示例

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


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

示例1: resetPassword

 static function resetPassword($data)
 {
     PDOSql::$pdobj = pdoConnect();
     $hash = Sql::esc($data['h']);
     $type = Sql::esc($data['t']);
     $email = Sql::esc($data['q']);
     $pass1 = Sql::esc($data['pass1']);
     $pass2 = Sql::esc($data['pass2']);
     if ($pass1 !== $pass2) {
         return array('success' => false, 'data' => '', 'msg' => 'Las contraseñas no coinciden');
     }
     if ($type == 'C') {
         $get_hash = "SELECT id, email, resetHash from clientes where email ='" . $email . "' AND resetHash = '" . $hash . "'";
         $delete_hash = "UPDATE clientes set password = MD5('" . $pass1 . "'), resetHash = null where email ='" . $email . "' AND resetHash = '" . $hash . "'";
     } elseif ($type == 'U') {
         $get_hash = "SELECT id, email, resetHash from usuarios where email ='" . $email . "' AND resetHash = '" . $hash . "'";
         $delete_hash = "UPDATE usuarios set password = MD5('" . $pass1 . "'), resetHash = null where email ='" . $email . "' AND resetHash = '" . $hash . "'";
     } else {
         return array('success' => false, 'data' => '', 'msg' => 'Problema con el reseteo');
     }
     $h = Sql::fetch($get_hash);
     if (count($h) == 1) {
         $u = Sql::update($delete_hash);
         return array('success' => true, 'data' => array('id' => $h[0]['id']), 'msg' => 'Se realizo la operacion con exito.');
     } else {
         return array('success' => false, 'data' => '', 'msg' => 'Codigo invalido');
     }
 }
开发者ID:scabros,项目名称:scabrosfw,代码行数:28,代码来源:Supportools.php

示例2: markAsRead

 static function markAsRead($id)
 {
     PDOSql::$pdobj = pdoConnect();
     $id = Sql::esc($id);
     $iduser = Sql::esc($_SESSION['userID']);
     $res = Sql::fetch("UPDATE notifications set status = '1', view_date = NOW() WHERE id = '{$id}' AND iduser = '{$iduser}'");
     return array('success' => true, 'data' => $res, 'msg' => '');
 }
开发者ID:scabros,项目名称:scabrosfw,代码行数:8,代码来源:Notifications.php

示例3: execute

 /**
  * Parses the template and executes the listing
  * @return void Prints the listing
  */
 public function execute()
 {
     if ($this->template == null) {
         Kernel::Log('There\'s no template, cannot generate listing');
         return false;
     } else {
         $columns = Text::parseStringVar($this->template);
         foreach ($columns as $key => $i) {
             if (in_array($i, array_keys($this->vars))) {
                 unset($columns[$key]);
             }
         }
         if (isset($this->options['max_regs']) && isset($this->options['page_index'])) {
             if ($this->options['max_regs'] < 2) {
                 Kernel::Log('The max_regs option must be higher than 1');
                 return false;
             }
             $rows_page = $this->options['max_regs'];
             $index = $this->options['page_index'];
             if (isset($this->options['criteria'])) {
                 $this->options['criteria'] = ' ' . $this->options['criteria'];
             } else {
                 $this->options['criteria'] = '';
             }
             $rows = Sql::numRows('SELECT ' . implode(', ', $columns) . ' FROM ' . $this->table . $this->options['criteria']);
             if (!isset($this->options['template_pag'])) {
                 $pag = new HTMLObj('div');
                 $pag->class = "sonicwulf_pages";
             } else {
                 $pag_html = '';
             }
             for ($i = 0; $i <= ceil($rows / $this->options['max_regs']) - 1; $i++) {
                 if (!isset($this->options['template_pag'])) {
                     $div = $pag->addChild('a');
                     $div->addContent($i);
                     $div->href = $_SERVER['PHP_SELF'] . '?' . $this->options['get_name'] . '=' . $i;
                     $div->class = 'sonicwulf_pagenum';
                 } else {
                     $parse = Text::parseStringVar($this->options['template_pag']);
                     if (in_array('href', $parse)) {
                         $pag_html .= str_replace('%page_link%', $_SERVER['PHP_SELF'] . '?' . $this->options['get_name'] . '=' . $i, $this->options['template_pag']);
                     } else {
                         Kernel::Log('There\'s no HREF attribute on the template, please add the atrribute');
                         return false;
                     }
                 }
             }
             if (!isset($this->options['template_pag'])) {
                 $pag_html = $pag->executeNoFormat();
             }
         } else {
             $rows_page = null;
             $index = null;
             $pag_html = null;
         }
         foreach ($this->getQuery($columns, $rows_page, $index) as $reg) {
             $string = $this->template;
             foreach ($columns as $i) {
                 if (isset($reg[$i])) {
                     $string = str_replace("%" . $i . "%", $reg[$i], $string);
                 }
             }
             foreach ($this->vars as $key => $i) {
                 if (is_array($i)) {
                     $data = Sql::fetch("SELECT " . $i[0] . " FROM " . $i[1] . $i[2]);
                     $string = str_replace("%" . $key . "%", $data[0][$i[0]], $string);
                 } else {
                     $string = str_replace("%" . $key . "%", $i, $string);
                 }
             }
             echo $string;
         }
         echo $pag_html;
     }
 }
开发者ID:studio-wolfree,项目名称:sonicwulf-php,代码行数:79,代码来源:Listing.php

示例4: rubros

 static function rubros()
 {
     PDOSql::$pdobj = pdoConnect();
     $rubs = Sql::fetch("SELECT rubro from rubros_generales ORDER BY id");
     $r = array();
     foreach ($rubs as $rub) {
         $r[] = array('rubro' => $rub['rubro']);
     }
     return $r;
 }
开发者ID:scabros,项目名称:scabrosfw,代码行数:10,代码来源:Collections.php


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