本文整理汇总了PHP中conexion::conn方法的典型用法代码示例。如果您正苦于以下问题:PHP conexion::conn方法的具体用法?PHP conexion::conn怎么用?PHP conexion::conn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类conexion
的用法示例。
在下文中一共展示了conexion::conn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: conexion
function basicTable2($header, $rut, $orden)
{
include_once '../conexion.php';
$this->SetFont('Arial', 'B', 15);
//SQL
$conexion = new conexion();
$conn = $conexion->conn();
$sql = "SELECT p.UrlFoto, p.nombreProducto, v.subTotal, v.iva, v.total " . "FROM venta_producto vp INNER JOIN productos p " . "ON vp.idProducto = p.idProducto INNER JOIN venta v " . "ON vp.idVenta = v.idVenta INNER JOIN carrito c " . "ON v.idCarrito = c.idCarrito INNER JOIN clientes cli " . "ON cli.rut = v.rut " . "WHERE cli.rut = " . $rut . " AND c.orden = '" . $orden . "';";
$rows = $conn->query($sql)->fetchAll();
//FIN SQL
$this->Cell(0, 10, utf8_decode('Total Pagado'), 0, 0, 'C');
$this->Ln(10);
$this->SetFont('Arial', 'B', 10);
foreach ($header as $col) {
$this->Cell(37.5, 7, $col, 1, 0, 'C');
}
$this->Ln();
//datos
foreach ($rows as $row) {
$urlFoto = $row['UrlFoto'];
$nombreProducto = $row['nombreProducto'];
$subTotal = $row['subTotal'];
$iva = $row['iva'];
$total = $row['total'];
}
$this->Cell(37.5, 6, utf8_decode(number_format($subTotal)), 1, 0, 'C');
$this->Cell(37.5, 6, utf8_decode(number_format($iva)), 1, 0, 'C');
$this->Cell(37.5, 6, utf8_decode(number_format($total)), 1, 0, 'C');
}
示例2: basicTable
function basicTable($header)
{
include_once '../conexion.php';
$this->SetFont('Arial', 'B', 10);
$conexion = new conexion();
$conn = $conexion->conn();
$sql = "SELECT * FROM clientes ORDER BY 1;";
$rows = $conn->query($sql)->fetchAll();
foreach ($header as $col) {
$this->Cell(39, 7, $col, 1, 0, 'C');
}
$this->Ln();
//datos
foreach ($rows as $row) {
$rut = $row['rut'];
$nombre = $row['nombre'] . ' ' . $row['apellido'];
$telefono = $row['telefono'];
$email = $row['email'];
$this->Cell(39, 7, utf8_decode($rut), 1, 0, 'R');
$this->Cell(39, 7, utf8_decode($nombre), 1, 0, 'R');
$this->Cell(39, 7, utf8_encode($telefono), 1, 0, 'R');
$this->Cell(39, 7, utf8_decode($email), 1, 0, 'R');
$this->Ln();
}
$this->Ln(5);
}
示例3: countDespacho
function countDespacho()
{
include_once '../conexion.php';
try {
$c = new conexion();
$conn = $c->conn();
$sql = "SELECT count(idDespacho)+1 AS 'count' FROM despacho;";
$rows = $conn->query($sql)->fetchAll();
foreach ($rows as $row) {
return $row['count'];
}
} catch (Exception $exc) {
echo $exc->getTraceAsString();
}
}
示例4: nombreComunas
function nombreComunas($idComuna)
{
include_once '../conexion.php';
try {
$conexion = new conexion();
$conn = $conexion->conn();
$sql = "SELECT nombreComuna FROM comunas WHERE idComuna = " . $idComuna . ";";
$rows = $conn->query($sql)->fetchAll();
foreach ($rows as $row) {
return $nombreComuna = $row['nombreComuna'];
}
} catch (Exception $ex) {
die;
} finally {
}
}
示例5: listadoTipoProductos
function listadoTipoProductos()
{
include_once '../conexion.php';
try {
$conexion = new conexion();
$conn = $conexion->conn();
$sql = "SELECT * FROM tipoproductos";
$rows = $conn->query($sql)->fetchAll();
foreach ($rows as $row) {
$idTipoProducto = $row['idTipoProducto'];
$descripcion = $row['descripcion'];
echo '<option value = "' . $idTipoProducto . '">' . $descripcion . '</option>';
}
} catch (Exception $ex) {
die;
} finally {
}
}
示例6: insertMetodoDePagos
function insertMetodoDePagos(MetodoDePagos $mp)
{
require_once '../conexion.php';
require_once '../model.business/MetodoDePagos.php';
try {
$idMetodoDePagos = $mp->getIdMetodosDePago();
$descripcion = $mp->getDescripcion();
$conexion = new conexion();
$conn = $conexion->conn();
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = $conn->prepare("INSERT INTO metodosDePago VALUES(:idMetodoDePagos,:descripcion);");
$sql->bindParam(':idMetodoDePagos', $idMetodoDePagos);
$sql->bindParam(':descripcion', $descripcion);
return $sql->execute();
} catch (PDOException $exc) {
return $exc->getMessage();
} finally {
}
}
示例7: passwordGerente
function passwordGerente($username)
{
require_once '../conexion.php';
require_once '../model.business/Cliente.php';
require_once '../model.business/Persona.php';
try {
$conexion = new conexion();
$cliente = new Cliente();
$sql = "SELECT contraseña FROM login WHERE username = " . $username . ";";
$conn = $conexion->conn();
$query = $conn->query($sql);
$rows = $query->fetchAll();
foreach ($rows as $row) {
return $contraseña = $row["contraseña"];
}
} catch (Exception $ex) {
$ex->getTraceAsString();
}
}
示例8: countCarrito
function countCarrito()
{
include_once '../conexion.php';
include_once '../model.business/Carro.php';
try {
$conexion = new conexion();
$conn = $conexion->conn();
$query = $conn->prepare("SELECT count(idCarrito)+1 as 'count' FROM carrito;");
$query->execute();
$rows = $query->fetchAll();
foreach ($rows as $row) {
return $row['count'];
}
return null;
} catch (PDOException $exc) {
die;
} finally {
}
}
示例9: maxMarcas
function maxMarcas()
{
include_once '../conexion.php';
include_once '../model.business/Carro.php';
try {
$conexion = new conexion();
$conn = $conexion->conn();
$query = $conn->prepare("SELECT MAX(idMarca)+1 as 'max' FROM marcas;");
$query->execute();
$rows = $query->fetchAll();
foreach ($rows as $row) {
return $row['max'];
}
return null;
} catch (PDOException $exc) {
die;
} finally {
}
}
示例10: insertLoginAdmin
function insertLoginAdmin(Administrador $a)
{
require_once '../conexion.php';
require_once '../model.business/Cliente.php';
try {
$username = $a->getUsername();
$password = $a->getPassword();
$conexion = new conexion();
$conn = $conexion->conn();
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = $conn->prepare("INSERT INTO login VALUES(:username,:password, 1);");
$sql->bindParam(':username', $username);
$sql->bindParam(':password', $password);
return $sql->execute();
} catch (PDOException $exc) {
return $exc->getCode();
} finally {
}
}
示例11: searchAdmin
function searchAdmin(Administrador $a)
{
require_once '../conexion.php';
require_once '../model.business/Administrador.php';
require_once '../model.business/Persona.php';
try {
$conexion = new conexion();
$administrador = new Administrador();
$sql = "SELECT a.nombre, a.apellido FROM administrador a " . "INNER JOIN login l ON a.username = l.username " . "WHERE l.username = '" . $a->getUsername() . "' AND l.contraseña = '" . $a->getPassword() . "';";
$conn = $conexion->conn();
$query = $conn->query($sql);
$rows = $query->fetchAll();
foreach ($rows as $row) {
$administrador->setUsername($a->getUsername());
$administrador->setPassword($a->getPassword());
$administrador->setRol(0);
$administrador->setNombre($row["nombre"]);
$administrador->setApellido($row["apellido"]);
}
return $administrador;
} catch (Exception $ex) {
$ex->getTraceAsString();
}
}
示例12: conexion
format: '<b>{point.name}</b>: {point.percentage:.1f} %',
style: {
color: (Highcharts.theme && Highcharts.theme.contrastTextColor) || 'black'
}
}
}
},
series: [{
type: 'pie',
name: 'Preferencia',
data: [
<?php
$c = new conexion();
$sql = "SELECT count(v.idProducto) 'cantidad',p.nombreProducto from venta_producto v INNER JOIN productos p ON p.idProducto = v.idProducto " . " GROUP BY 2;";
//se conecta a la BD
$conn = $c->conn();
//Crea la consulta
$query = $conn->query($sql);
//Toma los valores de la consulta;
$rows = $query->fetchAll();
foreach ($rows as $row) {
?>
['<?php
echo $row['nombreProducto'];
?>
', <?php
echo $row['cantidad'];
?>
],
<?php
}
示例13: listaProductosXOrdenesSegundaParte
function listaProductosXOrdenesSegundaParte($rut, $orden)
{
include_once '../conexion.php';
try {
$conexion = new conexion();
$conn = $conexion->conn();
$sql = "SELECT p.UrlFoto, p.nombreProducto, v.subTotal, v.iva, v.total " . "FROM venta_producto vp INNER JOIN productos p " . "ON vp.idProducto = p.idProducto INNER JOIN venta v " . "ON vp.idVenta = v.idVenta INNER JOIN carrito c " . "ON v.idCarrito = c.idCarrito INNER JOIN clientes cli " . "ON cli.rut = v.rut " . "WHERE cli.rut = " . $rut . " AND c.orden = '" . $orden . "';";
$rows = $conn->query($sql)->fetchAll();
foreach ($rows as $row) {
$urlFoto = $row['UrlFoto'];
$nombreProducto = $row['nombreProducto'];
$subTotal = $row['subTotal'];
$iva = $row['iva'];
$total = $row['total'];
}
echo "<div class='w3-row-padding'>";
echo "<div class='w3-col m2'>";
echo number_format($subTotal);
echo "</div>";
echo "<div class='w3-col m2'>";
echo number_format($iva);
echo "</div>";
echo "<div class='w3-col m2'>";
echo number_format($total);
echo "</div>";
echo "<div class='w3-col m1'> </div>";
echo "</div>";
} catch (Exception $exc) {
}
}
示例14: deleteProducto
function deleteProducto($idProducto)
{
require_once '../conexion.php';
require_once '../model.business/Producto.php';
try {
$conexion = new conexion();
$conn = $conexion->conn();
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sql = $conn->prepare("DELETE FROM productos WHERE idProducto = :idProducto ;");
$sql->bindParam(':idProducto', $idProducto);
return $sql->execute();
} catch (PDOException $exc) {
echo $exc->getMessage();
}
}
示例15: buscarClienteXRut
function buscarClienteXRut($rut)
{
require_once '../conexion.php';
require_once '../model.business/Cliente.php';
require_once '../model.business/Persona.php';
try {
$conexion = new conexion();
$cliente = new Cliente();
$sql = "SELECT c.nombre, c.apellido,c.rut,c.telefono, c.email FROM clientes c " . "INNER JOIN login l ON c.username = l.username " . "WHERE c.rut = " . $rut . ";";
$conn = $conexion->conn();
$query = $conn->query($sql);
$rows = $query->fetchAll();
foreach ($rows as $row) {
$cliente->setNombre($row["nombre"]);
$cliente->setApellido($row["apellido"]);
$cliente->setRut($row["rut"]);
$cliente->setTelefono($row["telefono"]);
$cliente->setEmail($row["email"]);
return $cliente;
}
return null;
} catch (Exception $ex) {
$ex->getTraceAsString();
}
}