當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。