本文整理汇总了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);
}
}
示例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;
}
示例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();
}
示例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");
示例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");