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


PHP Connect::query方法代码示例

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


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

示例1: __construct

 public function __construct()
 {
     $db = new Connect();
     $act = $db->query("SELECT ultima_act FROM generales LIMIT 1;");
     $actualizacion = $db->recorrer($act);
     if (time() >= $actualizacion[0]) {
         $tops = $db->query("SELECT id,puntos FROM usuarios ORDER by puntos DESC;");
         $tope = 1;
         $psql = "UPDATE usuarios SET top = ? WHERE id = ? LIMIT 1;";
         $prepare_query = $db->prepare($psql);
         $prepare_query->bind_param('ii', $nuevo_top, $id_user);
         while ($top = $db->recorrer($tops)) {
             $nuevo_top = $tope++;
             $id_user = $top['id'];
             $prepare_query->execute();
         }
         $timer = time() + 30;
         $query = $db->query("UPDATE generales SET ultima_act='{$timer}' LIMIT 1;");
         $prepare_query->close();
         unset($actualizar, $tops, $timer, $tope, $query);
     } else {
         unset($actualizacion);
     }
     $db->liberar($act);
     $db->close();
 }
开发者ID:Nykus,项目名称:xnova,代码行数:26,代码来源:class.UpdateStats.php

示例2: Register

 public function Register()
 {
     try {
         if ($_POST['user'] and $_POST['pass'] and $_POST['email']) {
             $db = new Connect();
             $this->user = $db->real_escape_string($_POST['user']);
             $this->email = $db->real_escape_string($_POST['email']);
             $this->pass = sha1($_POST['pass']);
             $sql = $db->query("SELECT usuario,email FROM usuarios \n                WHERE usuario='{$this->user}' OR email='{$this->email}' LIMIT 1;");
             if ($db->rows($sql) == 0) {
                 $sql2 = $db->query("SELECT COUNT(id) FROM usuarios LIMIT 1;");
                 $top = $db->recorrer($sql2);
                 $top = $top[0] + 1;
                 $sql3 = $db->query("INSERT INTO usuarios (usuario,password,email,faccion,top) \n                    VALUES ('{$this->user}','{$this->pass}','{$this->email}','1','{$top}');");
                 $sql4 = $db->query("SELECT MAX(id) AS id FROM usuarios LIMIT 1;");
                 $id = $db->recorrer($sql4);
                 $id = $id[0];
                 $db->liberar($sql, $sql2, $sql3, $sql4);
                 require 'core/models/class.GeneratePlanet.php';
                 $planeta = new GeneratePlanet();
                 $planeta->RegisterPlanet($id);
                 $planet = $db->query("SELECT id_planeta FROM planetas WHERE id_dueno='{$id}' LIMIT 1;");
                 $id_planet = $db->recorrer($planet);
                 $id_planet = $id_planet[0];
                 $_SESSION['id_planet'] = $id_planet;
                 $_SESSION['user'] = $this->user;
                 $_SESSION['id'] = $id;
                 unset($sql, $sql2, $sql3, $sql4, $top, $db, $id, $this->email, $this->pass);
                 echo 1;
                 $db->liberar($planet);
                 $db->close();
             } else {
                 $dato = $db->recorrer($sql);
                 $db->liberar($sql);
                 $db->close();
                 $lng = new Lang();
                 if (strtolower($dato[1]) == strtolower($this->email) and strtolower($dato[0]) != strtolower($this->user)) {
                     throw new Exception($lng->e_email_existe);
                 } else {
                     if (strtolower($dato[1]) != strtolower($this->email) and strtolower($dato[0]) == strtolower($this->user)) {
                         throw new Exception($lng->e_user_existe);
                     } else {
                         throw new Exception($lng->e_user_email_existe);
                     }
                 }
                 unset($sql, $db, $lng, $dato, $this->user, $this->email, $this->pass);
             }
         } else {
             throw new Exception('error');
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
     exit;
 }
开发者ID:prinick96,项目名称:xnova,代码行数:55,代码来源:class.Access.php

示例3: Register

 public function Register()
 {
     if (!empty($_POST['user']) and !empty($_POST['pass']) and !empty($_POST['email'])) {
         $db = new Connect();
         $this->user = $db->real_escape_string($_POST['user']);
         $this->email = $db->real_escape_string($_POST['email']);
         $this->pass = sha1($_POST['pass']);
         $sql = $db->query("SELECT usuario,email FROM usuarios \n            WHERE usuario='{$this->user}' OR email='{$this->email}' LIMIT 1;");
         if ($db->rows($sql) == 0) {
             $sql2 = $db->query("SELECT COUNT(id) FROM usuarios LIMIT 1;");
             $top = $db->recorrer($sql2);
             $top = $top[0] + 1;
             $sql3 = $db->query("INSERT INTO usuarios (usuario,password,email,faccion,top) \n                VALUES ('{$this->user}','{$this->pass}','{$this->email}','1','{$top}');");
             $sql4 = $db->query("SELECT MAX(id) AS id FROM usuarios LIMIT 1;");
             $id = $db->recorrer($sql4);
             $id = $id[0];
             $db->liberar($sql, $sql2, $sql3, $sql4);
             require 'core/models/class.GeneratePlanet.php';
             $planeta = new GeneratePlanet();
             $planeta->RegisterPlanet($id);
             $planet = $db->query("SELECT id_planeta FROM planetas WHERE id_dueno='{$id}' LIMIT 1;");
             $id_planet = $db->recorrer($planet);
             $id_planet = $id_planet[0];
             $_SESSION['id_planet'] = $id_planet;
             $_SESSION['user'] = $this->user;
             $_SESSION['id'] = $id;
             $login = '<script>window.location="?core=overview";</script>';
             $db->liberar($planet);
             $db->close();
             unset($sql, $sql2, $sql3, $sql4, $top, $db, $id, $this->email, $this->pass);
         } else {
             $dato = $db->recorrer($sql);
             $db->liberar($sql);
             $db->close();
             $lng = new Lang();
             if (strtolower($dato[1]) == strtolower($this->email) and strtolower($dato[0]) != strtolower($this->user)) {
                 $login = $lng->e_email_existe;
             } else {
                 if (strtolower($dato[1]) != strtolower($this->email) and strtolower($dato[0]) == strtolower($this->user)) {
                     $login = $lng->e_user_existe;
                 } else {
                     $login = $lng->e_user_email_existe;
                 }
             }
             unset($sql, $db, $lng, $dato, $this->user, $this->email, $this->pass);
         }
     } else {
         $lng = new Lang();
         $login = $lng->e_datos_vac;
         unset($lng);
     }
     echo $login;
     unset($login);
 }
开发者ID:Nykus,项目名称:xnova,代码行数:54,代码来源:class.Access.php

示例4: getMessageById

 public function getMessageById($id, $user = NULL)
 {
     $userid = !empty($user) ? $user : $this->user;
     $sql = "SELECT id FROM *PREFIX*collab_user_message WHERE mid = " . $id . " AND uid = '" . $userid . "'";
     $um = $this->connect->query($sql);
     if (empty($um['id'])) {
         $this->createStatus($id, $userid, 0);
     }
     $sql = "SELECT um.id as id, m.date, m.title, m.text, m.attachements, m.author, m.subscribers, um.mid as mid, um.status" . " FROM *PREFIX*collab_user_message um" . " INNER JOIN *PREFIX*collab_messages m ON m.id = um.mid" . " WHERE um.mid = " . $id . " AND um.uid = '" . $userid . "'" . " ORDER BY m.date DESC";
     $message = $this->connect->query($sql);
     return $message;
 }
开发者ID:bogolubov,项目名称:owncollab_talks-1,代码行数:12,代码来源:usermessages.php

示例5: adminId

 function adminId()
 {
     $query = "SELECT adminId FROM Admins WHERE email='{$this->email}'";
     $adminIdArr = parent::query($query);
     $size = sizeof($adminIdArr);
     return parent::validateIndexes($adminArr, 0, 'adminId');
 }
开发者ID:nateirwin,项目名称:custom-historic,代码行数:7,代码来源:Admins.php

示例6: getDataSP

 public function getDataSP($flag, $criterio = '', $page = 1, $regxpag = 10)
 {
     $DB = new Connect();
     $sql = "CALL dataGrid('" . $flag . "','" . $criterio . "','" . $page . "','" . $regxpag . "')";
     // ejecutamos
     $data = $DB->query($sql);
     $result = $data->fetchAll(PDO::FETCH_ASSOC);
     // que sea un array asociativo
     return $result;
 }
开发者ID:pablotebb,项目名称:RDDatagrid,代码行数:10,代码来源:ConsultarData.php

示例7: storeId

 function storeId()
 {
     $query = "SELECT storeId FROM Stores WHERE name='{$this->storeName}'";
     $storeIdArr = parent::query($query);
     $size = sizeof($storeIdArr);
     if ($size == 0) {
         return 0;
     } else {
         return $storeIdArr[0]['storeId'];
     }
 }
开发者ID:nateirwin,项目名称:custom-historic,代码行数:11,代码来源:Stores.php

示例8: __construct

 public function __construct($id_planet)
 {
     parent::__construct($id_planet);
     $db = new Connect();
     $sql = $db->query("SELECT imagen,nombre,campos,campos_usados,temperatura,pos,sistema,metal,cristal,tritio,materia\n        FROM planetas WHERE id_planeta='{$id_planet}' LIMIT 1;");
     $planeta = $db->recorrer($sql);
     $this->planet = array('image' => $planeta['imagen'], 'name' => $planeta['nombre'], 'fields' => $planeta['campos'], 'used_fields' => $planeta['campos_usados'], 'temperature' => $planeta['temperatura'], 'orbit' => $planeta['pos'], 'solar' => $planeta['sistema'], 'metal' => $planeta['metal'], 'cristal' => $planeta['cristal'], 'tritio' => $planeta['tritio'], 'matter' => $planeta['materia']);
     $db->liberar($sql);
     $db->close();
     unset($planeta, $db, $sql);
 }
开发者ID:Nykus,项目名称:xnova,代码行数:11,代码来源:class.Planet.php

示例9: read

 function read($sessId)
 {
     $prefs = new Preferences();
     $idle = $prefs->idleTime();
     $expiry = time() - $idle;
     $query = "SELECT data FROM Sessions WHERE sessId='{$sessId}' AND lastAccess >= {$expiry}";
     $data = parent::query($query);
     if (isset($data[0])) {
         return $data[0]['data'];
     } else {
         return '';
     }
 }
开发者ID:nateirwin,项目名称:custom-historic,代码行数:13,代码来源:StoreSessionDB.php

示例10: __construct

 public function __construct($id_planeta)
 {
     $this->id = $id_planeta;
     $db = new Connect();
     $sql = $db->query("SELECT edificios.fuente_base, edificios.planta_energia, edificios.reactor_fusion, \n        edificios.mina_metal, edificios.mina_cristal, edificios.mina_tritio, \n        edificios.almacen_metal, edificios.almacen_cristal, edificios.almacen_tritio, \n        edificios.satelites, edificios.modulos, edificios.almacen_materia, edificios.distribuidor, edificios.nanobots,\n        planetas.metal, planetas.cristal, planetas.tritio, \n        planetas.ultima_act, planetas.temp_promd FROM edificios, planetas WHERE edificios.id_planeta='{$this->id}' \n        AND planetas.id_planeta='{$this->id}' LIMIT 1;");
     $dat = $db->recorrer($sql);
     $this->niveles = array('mina_metal' => $dat['mina_metal'], 'mina_cristal' => $dat['mina_cristal'], 'mina_tritio' => $dat['mina_tritio'], 'reactor_fusion' => $dat['reactor_fusion'], 'planta_energia' => $dat['planta_energia'], 'distribuidor' => $dat['distribuidor'], 'satelites' => $dat['satelites'], 'modulos' => $dat['modulos'], 'almacen_metal' => $dat['almacen_metal'], 'almacen_cristal' => $dat['almacen_cristal'], 'almacen_tritio' => $dat['almacen_tritio'], 'almacen_materia' => $dat['almacen_materia'], 'nanobots' => $dat['nanobots']);
     $this->metal = $dat['metal'];
     $this->cristal = $dat['cristal'];
     $this->tritio = $dat['tritio'];
     $tiempo = time();
     $time = $tiempo - $dat['ultima_act'];
     parent::__construct($time, $this->niveles, $dat['fuente_base'], $dat['temp_promd'], $this->tritio);
     $prod_metal = $this->metal >= $this->getMetalCapacity() ? 0 : $this->getMetalProd();
     $prod_cristal = $this->cristal >= $this->getCristalCapacity() ? 0 : $this->getCristalProd();
     $prod_tritio = $this->tritio >= $this->getTritioCapacity() ? 0 : $this->getTritioProd();
     $this->prod_resources = array('metal' => $prod_metal, 'cristal' => $prod_cristal, 'tritio' => $prod_tritio);
     //Actualizacion de recursos cada tano
     $update = $db->query("UPDATE planetas SET ultima_act='{$tiempo}', metal= metal + '{$prod_metal}', \n        cristal= cristal + '{$prod_cristal}', tritio= tritio + '{$prod_tritio}' WHERE id_planeta='{$this->id}'");
     $db->liberar($sql, $update);
     $db->close();
     unset($prod_metal, $prod_cristal, $prod_tritio, $tiempo, $db);
 }
开发者ID:Nykus,项目名称:xnova,代码行数:23,代码来源:class.Resources.php

示例11: getData

 public function getData($flag,$criterio=''){
     $DB = new Connect();
     
     if($flag == 'P'){
         $sql = "SELECT nombres,apellidos FROM f_trabajador";
         if(!empty($criterio)){
             $sql .= " WHERE CONCAT(nombres,' ',apellidos) LIKE '%".$criterio."%' ";
         }
         
         $data = $DB->query($sql);
         $result = $data->fetchAll(PDO::FETCH_ASSOC);
     }
     
     return $result;
 }
开发者ID:juamir,项目名称:DATAGRID,代码行数:15,代码来源:ConsultarData.php

示例12: __construct

 public function __construct($id_user)
 {
     $this->id = $id_user;
     $db = new Connect();
     $sql = $db->query("SELECT usuario,email,faccion,puntos,alianza,top FROM usuarios WHERE id='{$this->id}' LIMIT 1;");
     $usuario = $db->recorrer($sql);
     $this->user = $usuario['usuario'];
     $this->email = $usuario['email'];
     $this->faction = $usuario['faccion'];
     $this->points = $usuario['puntos'];
     $this->alliance = $usuario['alianza'];
     $this->rank = $usuario['top'];
     $db->liberar($sql);
     $db->close();
     unset($sql, $db, $usuario, $this->id);
 }
开发者ID:Nykus,项目名称:xnova,代码行数:16,代码来源:class.User.php

示例13: __construct

 public function __construct($register)
 {
     if ($register === true) {
         //si esto es true, es porque se está pasando del registro
         $db = new Connect();
         $sql = $db->query("SELECT ultima_pos,ultimo_sis FROM generales LIMIT 1;");
         $coordenada = $db->recorrer($sql);
         $db->liberar($sql);
         $db->close();
         $this->u_orbit = $coordenada['ultima_pos'];
         $this->u_system = $coordenada['ultimo_sis'];
         $this->register = true;
         unset($sql, $db, $coordenada);
     } else {
         $this->u_orbit = 'LA ORBITA DE LA MISIO';
         $this->u_system = 'EL SISTEMA DE LA MISIÓN';
         $this->register = false;
     }
 }
开发者ID:Nykus,项目名称:xnova,代码行数:19,代码来源:class.UniversePosition.php

示例14: newFile

 /**
  * Inserts uploaded file into database
  * @param array $file
  */
 public function newFile($file, $path)
 {
     $sql = "SELECT id FROM *PREFIX*mimetypes WHERE mimetype = '" . $file['mimetype'] . "'";
     $res = $this->connect->query($sql);
     $mimetype = $res['id'];
     $sql = "SELECT numeric_id FROM *PREFIX*storages WHERE id = 'home::" . $file['owner'] . "'";
     $res = $this->connect->query($sql);
     $storageid = $res['numeric_id'];
     $sql = "SELECT fileid FROM *PREFIX*filecache WHERE path = '" . $file['path'] . "'";
     $res = $this->connect->query($sql);
     $parent = $res['fileid'];
     //$path = '/var/www/owncloud.loc/data/admin/files/Photos/San Francisco.jpg';
     list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($path . '/' . $file['filename']);
     $etag = $storage->getETag($internalPath);
     $data = array('storage' => $storageid, 'path' => $file['path'] . '/' . $file['filename'], 'path_hash' => md5($file['path'] . '/' . $file['filename']), 'parent' => $parent, 'name' => $file['filename'], 'mimetype' => $mimetype, 'mimepart' => 5, 'size' => $file['size'], 'mtime' => $file['mtime'], 'storage_mtime' => $file['storage_mtime'], 'etag' => $etag, 'permissions' => \OCP\Constants::PERMISSION_ALL);
     $filecache = $this->save($data);
     /* file_put_contents('/tmp/inb.log', "\nPath : /\n", FILE_APPEND);
             try { 
     		$fileInfo = \OC\Files\Filesystem::getFileInfo('/', false); 
             } 
             catch (\Exception $e) {
     		file_put_contents('/tmp/inb.log', "\nGet File Info error : " . $e->getMessage() . "\n", FILE_APPEND);
     	}
             file_put_contents('/tmp/inb.log', "\nFile info : " . print_r($fileInfo, true) . "\n", FILE_APPEND);
             try { 
     		$icon = \OCA\Files\Helper::determineIcon($fileInfo); 
             } 
             catch (\Exception $e) {
     		file_put_contents('/tmp/inb.log', "\nDetermine Icon error : " . $e->getMessage() . "\n", FILE_APPEND);
     	} */
     $activity = array('activity_id' => NULL, 'timestamp' => $file['mtime'], 'priority' => 30, 'type' => 'file_created', 'user' => $file['owner'], 'affecteduser' => $file['owner'], 'app' => 'files', 'subject' => 'created_self', 'subjectparams' => '["\\/' . $file['filename'] . '"]', 'message' => '', 'messageparams' => '[]', 'file' => '/' . $file['filename'], 'link' => $file['domain'] . '/index.php/apps/files?dir=%2F', 'object_type' => 'files', 'object_id' => $filecache);
     $id = $this->connect->insert('*PREFIX*activity', $activity);
     if ($id) {
         return $filecache;
     } else {
         return false;
     }
 }
开发者ID:bogolubov,项目名称:owncollab_talks-1,代码行数:42,代码来源:files.php

示例15: __construct

 private function __construct()
 {
     require 'core/models/class.User.php';
     require 'core/models/implement.Menu.php';
     require 'core/models/class.Planet.php';
     require 'core/models/implement.Topnav.php';
     global $id_user, $id_planet;
     $lng = new Lang();
     $menu = new Menu($id_user);
     $topnav = new Topnav($id_planet, $id_user);
     $user = new User($id_user);
     $planet = new Planet($id_planet);
     require 'core/functions/class.UpdateStats.php';
     $update = new UpdateStats();
     $db = new Connect();
     $sql = $db->query("SELECT COUNT(*) id FROM usuarios;");
     $total_rank = $db->recorrer($sql);
     $db->liberar($sql);
     $db->close();
     $template = new Smarty();
     $template->assign(array('usuario_email' => $user->UserEmail(), 'usuario_faccion' => $user->UserFaction(), 'usuario_puntos' => $user->UserPoints(), 'usuario_top' => $user->TopUser(), 'total_rank' => number_format($total_rank[0], '0', ',', '.'), 'campos' => $planet->PlanetFields(), 'diametro' => $planet->PlanetDiameter(), 'temperatura' => $planet->PlanetTemperature(), 'p' => $planet->PlanetOrbit(), 's' => $planet->PlanetSystem(), 'nombre_planeta' => $planet->PlanetName(), 'imagen_planeta' => $planet->PlanetImage()));
     $template->display('overview/overview.xnv');
 }
开发者ID:Nykus,项目名称:xnova,代码行数:23,代码来源:overviewController.php


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