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


PHP Conexion::query方法代码示例

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


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

示例1: dbsave

 function dbsave()
 {
     $db = new Conexion();
     if (!empty($this->id)) {
         $update = "UPDATE `" . $this->tabla . "` SET ";
         $arrayCampos = array();
         foreach ($this->campos as $c => $nombre) {
             $arrayCampos[] = "`" . $c . "` = '" . $this->{$c} . "'";
         }
         $update .= implode(', ', $arrayCampos);
         $update .= " WHERE id = '" . $this->id . "'";
         $db->query($update);
         return $this->id;
     } else {
         $insert = "INSERT INTO `" . $this->tabla . "`\n\t\t  \t\t\t\t\tVALUES(";
         $arrayCampos = array();
         foreach ($this->campos as $c => $nombre) {
             if ($c != 'id') {
                 $arrayCampos[] = "'" . $this->{$c} . "'";
             } else {
                 $arrayCampos[] = '0';
             }
         }
         $insert .= implode(', ', $arrayCampos);
         $insert .= ");";
         $db->query($insert);
         return $db->insertId();
     }
 }
开发者ID:jesusgm,项目名称:tareas,代码行数:29,代码来源:1modelo.php

示例2: Users

function Users()
{
    $db = new Conexion();
    $query = $db->query("SELECT timer FROM config WHERE id='1' LIMIT 1;");
    $timer = $db->recorrer($query)[0];
    $db->liberar($query);
    $sql = $db->query("SELECT * FROM users;");
    $usuarios_actuales = $db->rows($sql);
    if (!isset($_SESSION['cantidad_usuarios'])) {
        $_SESSION['cantidad_usuarios'] = $usuarios_actuales;
    }
    if ($_SESSION['cantidad_usuarios'] != $usuarios_actuales or time() - 60 <= $timer) {
        while ($d = $db->recorrer($sql)) {
            $users[$d['id']] = $d;
        }
    } else {
        if (!isset($_SESSION['users'])) {
            while ($d = $db->recorrer($sql)) {
                $users[$d['id']] = $d;
            }
        } else {
            $users = $_SESSION['users'];
        }
    }
    $_SESSION['users'] = $users;
    $db->liberar($sql);
    $db->close();
    return $_SESSION['users'];
}
开发者ID:prinick96,项目名称:OcrendBB,代码行数:29,代码来源:Users.php

示例3: Entrar

 public function Entrar()
 {
     $this->user = $_SESSION['user'];
     $this->id = $_SESSION['id'];
     $this->status = $_SESSION['estado'];
     $db = new Conexion();
     $sqle = "SELECT * FROM user WHERE user='{$this->user}' and id ='{$this->id}' and status = '{$this->status}'";
     $result = $db->query($sqle);
     $sqle = "UPDATE user SET status='1'";
     $result = $db->query($sqle);
     $sqle = "SELECT * FROM user WHERE user='{$this->user}' and id ='{$this->id}'";
     $result = $db->query($sqle);
     $datos = $db->recorrer($result);
     $_SESSION['status'] = $datos['status'];
 }
开发者ID:Grieta,项目名称:db,代码行数:15,代码来源:function.salir.php

示例4: Login

 public function Login()
 {
     try {
         if (!empty($_POST['user']) and !empty($_POST['pass']) and !empty($_POST['session'])) {
             $db = new Conexion();
             $this->user = $db->real_escape_string($_POST['user']);
             $this->pass = $db->real_escape_string($_POST['pass']);
             //encriptar el login
             $sql = $db->query("SELECT * FROM usuarios WHERE user = '{$this->user}' AND pass = '{$this->pass}' ");
             if ($db->rows($sql) > 0) {
                 $datos = $db->recorrer($sql);
                 $_SESSION['user'] = $datos['user'];
                 $_SESSION['email'] = $datos['email'];
                 $_SESSION['id'] = $datos['id'];
                 if ($_POST['session'] == true) {
                     ini_set('session.cookie.lifetime', time() + 60 * 60 * 24 * 2);
                 }
                 echo 1;
             } else {
                 throw new Exception(2);
             }
             $db->liberar($sql);
             $db->close();
         } else {
             throw new Exception('Error: Datos vacios.');
         }
     } catch (Exception $login) {
         echo $login->getMessage();
     }
 }
开发者ID:kosx2000,项目名称:grieta,代码行数:30,代码来源:class.Acceso.php

示例5: Registrar

 public function Registrar()
 {
     try {
         if (!empty($_POST['user']) and !empty($_POST['pass']) and !empty('email')) {
             $bd = new Conexion();
             $this->user = $bd->real_escape_string($_POST['user']);
             $this->email = $bd->real_escape_string($_POST['email']);
             $this->pass = $this->Encrypt($_POST['pass']);
             $sql = $bd->query("SELECT * FROM USUARIOS WHERE user='{$this->user}' OR email = '{$this->email}';");
             if ($bd->rows($sql) == 0) {
                 $online = time() + 60 * 5;
                 $sql2 = $bd->query("INSERT INTO usuarios(user, pass, email, online)\n                     VALUES ('{$this->user}','{$this->pass}','{$this->email}', '{$online}');");
                 $sql3 = $bd->query("SELECT MAX(id) AS id FROM USUARIOS;");
                 $id = $bd->recorrer($sql3);
                 $_SESSION['id'] = $id[0];
                 $_SESSION['user'] = $this->user;
                 $_SESSION['email'] = $this->email;
                 $_SESSION['fecha'] = '';
                 $_SESSION['nombre'] = '';
                 $_SESSION['apellido'] = '';
                 $_SESSION['cambio'] = 0;
                 $_SESSION['ext'] = 'jpg';
                 $_SESSION['online'] = $online;
                 echo 1;
                 $bd->liberar($sql2, $sql3);
             } else {
                 $datos = $bd->recorrer($sql);
                 if (strtolower($this->user) == strtolower($datos['user'])) {
                     throw new Exception(2);
                 } else {
                     throw new Exception(3);
                 }
             }
             $bd->liberar($sql);
             $bd->close();
         } else {
             throw new Exception('Error: Datos Vacios.');
         }
     } catch (Exception $reg) {
         echo $reg->getMessage();
     }
 }
开发者ID:rafael1210,项目名称:Android,代码行数:42,代码来源:class.Acceso.php

示例6: Fechatrabajo

 public function Fechatrabajo()
 {
     $db = new Conexion();
     $query = "INSERT INTO fecha_trabajo (usuario_idusuario,fecha) \nVALUES ('{$this->idusuario}','{$this->fecha}')\nON DUPLICATE KEY UPDATE fecha='{$this->fecha}'";
     $result = $db->query($query);
     if ($result) {
         echo "<script>\nwindow.location='/admin-control-de-fabricacion/pages/creacion-de-reporte';\n</script>";
     } else {
         echo "<script>\nalert('HA OCURRIDO UN ERROR');\nwindow.location='/admin-control-de-fabricacion/home';\n</script>";
     }
     $db->close();
 }
开发者ID:Overprime,项目名称:admin-control-de-fabricacion,代码行数:12,代码来源:Fecha.php

示例7: citas

 public function citas()
 {
     $template = new Smarty();
     $db = new Conexion();
     $sql = $db->query("SELECT * FROM alertas WHERE Activada=-1 and Fecha date_add(NOW(),INTERVAL 1 MONTH) ORDER BY Fecha ASC;");
     if ($db->rows($sql) > 0) {
         while ($x = $db->recorrer($sql)) {
             $citas[] = array('id' => $x['Id'], 'fecha' => $x['Fecha'], 'alerta' => $x['Alerta']);
         }
         $template->assign('citas', $citas);
     }
     $template->assign('principal/citas.tpl');
 }
开发者ID:loro102,项目名称:rumbo-core,代码行数:13,代码来源:Class.Principal.php

示例8: eliminarAvisosViejos

 public function eliminarAvisosViejos()
 {
     $fecha = date('Y-m-j');
     $nuevafecha = strtotime('-1 day', strtotime($fecha));
     $nuevafecha = date('Y-m-j', $nuevafecha);
     try {
         $db = new Conexion();
         $db->query("delete from avisos where fecha <'{$nuevafecha}'");
         return 'success2';
     } catch (Exception $exc) {
         return 'error';
     }
 }
开发者ID:jorgeucr,项目名称:AvisosEscuelaRep,代码行数:13,代码来源:AvisosDATA.php

示例9: Registrar

 public function Registrar()
 {
     try {
         if (!empty($_POST['user']) and !empty($_POST['pass']) and !empty($_POST['email'])) {
             $db = new Conexion();
             $this->user = $db->real_escape_string($_POST['user']);
             $this->email = $db->real_escape_string($_POST['email']);
             $this->pass = $this->Encrypt($_POST['pass']);
             $sql = $db->query("SELECT * FROM users\n                                  WHERE user='{$this->user}' OR email='{$this->email}';");
             if ($db->rows($sql) == 0) {
                 $sqlTwo = $db->query("INSERT INTO users (user, pass, email)\n                                  VALUES ('{$this->user}', '{$this->pass}', '{$this->email}');");
                 $id = $db->insert_id;
                 $_SESSION['id'] = $id;
                 $_SESSION['user'] = $this->user;
                 $_SESSION['email'] = $this->email;
                 $_SESSION['first_name'] = '';
                 $_SESSION['last_name'] = '';
                 $_SESSION['date'] = '';
                 $_SESSION['changes'] = 0;
                 echo 1;
                 $db->liberar($sqlTwo);
             } else {
                 $datos = $db->recorrer($sql);
                 if (strtolower($this->user) == strtolower($datos['user'])) {
                     throw new Exception(2);
                 } else {
                     throw new Exception(3);
                 }
             }
             $db->liberar($sql);
             $db->close();
         } else {
             throw new Exception('ERROR: Datos vacios.');
         }
     } catch (Exception $e) {
         echo $e->getMessage();
     }
 }
开发者ID:felixacdc,项目名称:Curso-de-PHP-Avanzado,代码行数:38,代码来源:class.Acceso.php

示例10: ListaCursos

function ListaCursos()
{
    $db = new Conexion();
    $sql = $db->query("SELECT * FROM cursos;");
    if ($db->rows($sql) > 0) {
        while ($d = $db->recorrer($sql)) {
            $cursos[$d['id_curso']] = array('id_curso' => $d['id_curso'], 'ficha' => $d['ficha'], 'nombre' => $d['nombre'], 'descripcion' => $d['descripcion'], 'reg_curso' => $d['reg_curso']);
        }
    } else {
        $cursos = false;
    }
    $db->liberar($sql);
    $db->close();
    return $cursos;
}
开发者ID:miketascon,项目名称:PlataformaEducativa,代码行数:15,代码来源:ListaCursos.php

示例11: Users

function Users()
{
    $db = new Conexion();
    $sql = $db->query("SELECT * FROM user  ;");
    if ($db->rows($sql) > 0) {
        while ($d = $db->recorrer($sql)) {
            $users[$d['id_user']] = array('id_user' => $d['id_user'], 'names' => $d['names'], 'last_names' => $d['last_names'], 'email' => $d['email'], 'password' => $d['password'], 'gender' => $d['gender'], 'permisos' => $d['permisos'], 'phone' => $d['phone'], 'cel_phone' => $d['cel_phone'], 'address' => $d['address'], 'names_country' => $d['names_country']);
        }
    } else {
        $users = false;
    }
    $db->liberar($sql);
    $db->close();
    return $users;
}
开发者ID:miketascon,项目名称:PlataformaEducativa,代码行数:15,代码来源:Users.php

示例12: ListaPais

function ListaPais()
{
    $db = new Conexion();
    $sql = $db->query("SELECT * FROM country ;");
    if ($db->rows($sql) > 0) {
        while ($d = $db->recorrer($sql)) {
            $pais[$d['id_country']] = array('id_country' => $d['id_country'], 'names_country' => $d['names_country']);
        }
    } else {
        $pais = false;
    }
    $db->liberar($sql);
    $db->close();
    return $pais;
}
开发者ID:miketascon,项目名称:PlataformaEducativa,代码行数:15,代码来源:ListaPais.php

示例13: Foros

function Foros()
{
    $db = new Conexion();
    $sql = $db->query("SELECT * FROM foros;");
    if ($db->rows($sql) > 0) {
        while ($d = $db->recorrer($sql)) {
            $foros[$d['id']] = array('id' => $d['id'], 'nombre' => $d['nombre'], 'descrip' => $d['descrip'], 'cantidad_mensajes' => $d['cantidad_mensajes'], 'cantidad_temas' => $d['cantidad_temas'], 'id_categoria' => $d['id_categoria'], 'estado' => $d['estado']);
        }
    } else {
        $foros = false;
    }
    $db->liberar($sql);
    $db->close();
    return $foros;
}
开发者ID:softw,项目名称:OcrendBB,代码行数:15,代码来源:Foros.php

示例14: Categorias

function Categorias()
{
    $db = new Conexion();
    $sql = $db->query("SELECT * FROM categorias;");
    if ($db->rows($sql) > 0) {
        while ($data = $db->recorrer($sql)) {
            $categorias[$data['id']] = $data;
        }
    } else {
        $categorias = false;
    }
    $db->liberar($sql);
    $db->close();
    return $categorias;
}
开发者ID:prinick96,项目名称:OcrendBB,代码行数:15,代码来源:Categorias.php

示例15: Users

function Users()
{
    $db = new Conexion();
    $sql = $db->query("SELECT * FROM users;");
    if ($db->rows($sql) > 0) {
        while ($d = $db->recorrer($sql)) {
            $users[$d['id']] = array('id' => $d['id'], 'user' => $d['user'], 'pass' => $d['pass'], 'email' => $d['email'], 'permisos' => $d['permisos']);
        }
    } else {
        $users = false;
    }
    $db->liberar($sql);
    $db->close();
    return $users;
}
开发者ID:emiliobs,项目名称:OcrendBB,代码行数:15,代码来源:Users.php


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