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


PHP Dao::query方法代码示例

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


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

示例1: getInfoByCode

 /**
  * 获取条码信息
  *
  * @param $code
  */
 public function getInfoByCode($code, $dbconfig)
 {
     try {
         $sql = "select * from jk_dnb_hgk_send where fc_tm='" . $code . "'";
         $dao = new Dao('', 'jk_dnb_hgk_send', '', false, $dbconfig);
         $rtn = $dao->query($sql)->toArray();
         $unicode = $dbconfig['unicode'];
         if (!$unicode) {
             $unicode = 'gb2312';
         }
         if ($rtn) {
             $rtn = $this->auto_charset($rtn, $unicode, 'utf8');
             $rtn = $rtn[0];
             $codeinfo['code'] = $rtn['fc_tm'];
             $codeinfo['factoryNo'] = $rtn['fvc_zzh'];
             $codeinfo['goodsName'] = $rtn['fvc_mc'];
             $codeinfo['spec'] = $rtn['fc_xs'];
             $codeinfo['current1'] = $rtn['fc_dl'];
             $codeinfo['voltage1'] = $rtn['fc_dy'];
             $codeinfo['direct'] = $rtn['fn_fx'];
             $codeinfo['constant'] = $rtn['fn_cs'] . '/' . $rtn['fn_cs_wg'];
             $codeinfo['grade'] = $rtn['fc_dj'] . '/' . $rtn['fc_dj_wg'];
             $codeinfo['madeIn'] = $rtn['fvc_zzc'];
             $codeinfo['madeDate'] = $rtn['fsd_ccrq'];
             $codeinfo['memo'] = '电能表';
             return $codeinfo;
         } else {
             $sql = "select * from jk_hgq_hgk_send where fc_tm='" . $code . "'";
             $rtn = $dao->query($sql)->toArray();
             if ($rtn) {
                 $rtn = $this->auto_charset($rtn, $unicode, 'utf8');
                 $rtn = $rtn[0];
                 $codeinfo['code'] = $rtn['fc_tm'];
                 $codeinfo['factoryNo'] = $rtn['fvc_zzh'];
                 $codeinfo['goodsName'] = $rtn['fvc_mc'];
                 $codeinfo['spec'] = $rtn['fc_xs'];
                 $codeinfo['current1'] = $rtn['fc_dl'];
                 $codeinfo['voltage1'] = $rtn['fc_dy'];
                 $codeinfo['direct'] = $rtn['fn_fx'];
                 $codeinfo['constant'] = $rtn['fn_cs'];
                 $codeinfo['grade'] = $rtn['fc_dj'];
                 $codeinfo['madeIn'] = $rtn['fvc_zzc'];
                 $codeinfo['madeDate'] = $rtn['fsd_ccrq'];
                 $codeinfo['memo'] = '互感器';
                 return $codeinfo;
             }
         }
         return false;
     } catch (Exception $e) {
         throw new Exception($e);
     }
 }
开发者ID:kenlong,项目名称:example,代码行数:57,代码来源:BXIF.class.php

示例2: exec

 public function exec($sql, $dbconfig, $unicode = 'gb2312')
 {
     $dao = new Dao('', 'jk_dnb_hgk_send', '', false, $dbconfig);
     $sql = $this->auto_charset($sql, 'utf8', $unicode);
     if (strpos($sql, 'select') !== false) {
         $result = $dao->query($sql)->toArray();
         if ($result) {
             $result = $this->auto_charset($result, $unicode, 'utf8');
             for ($i = 0; $i < count($result); $i++) {
                 for ($j = count($result[$i]); $j >= 0; $j--) {
                     unset($result[$i][$j]);
                 }
             }
             $rtn["result"] = true;
             $rtn["value"] = $result;
         } else {
             $rtn["result"] = false;
         }
     } else {
         $result = $dao->execute($sql);
         if ($result) {
             $rtn["result"] = true;
             $rtn["value"] = $result;
         } else {
             $rtn["result"] = false;
         }
     }
     return $rtn;
 }
开发者ID:kenlong,项目名称:example,代码行数:29,代码来源:SQLTest.php

示例3: Dao

<?php

/**
 * User: Deliang Yang
 * Version: 0.1.0.0
 * Date: 14-9-12
 * Time: 下午8:37
 */
include "../Dao/Dao.class.php";
if (isset($_POST["doo"])) {
    $dao = new Dao("blog");
    $sql = "DELETE FROM comment WHERE id = {$_POST['doo']}";
    //$dao->close();
    $dao->query($sql);
    $dao->error();
}
开发者ID:deliangyang,项目名称:Blog,代码行数:16,代码来源:test.php

示例4: header

<?php

session_start();
if (!isset($_SESSION['acceso'])) {
    header('Location: login.php');
}
include "clases/Dao.php";
$db;
$db = new Dao(array('server_ip' => 'localhost', 'server_user' => 'root', 'server_password' => '', 'server_db' => 'inventario_telematica'));
$valor = $_POST['pr_id'];
$pr_codigo = $_POST['pr_codigo'];
$pr_nombre = $_POST['pr_nombre'];
$pr_categoria = $_POST['pr_categoria'];
$pr_preciocompra = $_POST['pr_preciocompra'];
$pr_precioventa = $_POST['pr_precioventa'];
$db->query("update productos set pr_codigo='{$pr_codigo}', pr_nombre = '{$pr_nombre}', pr_categoria = '{$pr_categoria}',pr_preciocompra = '{$pr_preciocompra}', pr_precioventa = '{$pr_precioventa}' where pr_id = {$valor}");
header("location: listado.php");
开发者ID:roger15,项目名称:projects,代码行数:17,代码来源:mod.php

示例5: header

<?php

session_start();
if (!isset($_SESSION['acceso'])) {
    header('Location: login.php');
}
include "clases/Dao.php";
$db;
$db = new Dao(array('server_ip' => 'localhost', 'server_user' => 'root', 'server_password' => '', 'server_db' => 'inventario_telematica'));
$valor = $_GET['pr_id'];
$borrar = $db->query("delete from productos where pr_id={$valor}");
header("location: listado.php");
开发者ID:roger15,项目名称:projects,代码行数:12,代码来源:eliminar.php


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