本文整理汇总了PHP中MySQL::ArrayResult方法的典型用法代码示例。如果您正苦于以下问题:PHP MySQL::ArrayResult方法的具体用法?PHP MySQL::ArrayResult怎么用?PHP MySQL::ArrayResult使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySQL
的用法示例。
在下文中一共展示了MySQL::ArrayResult方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: casosSurto
function casosSurto($comNome = true)
{
$nomeId = $comNome ? 'id' : 'i';
$nomeTotal = $comNome ? 'total' : 't';
$select = $comNome ? "nome, tabela as '{$nomeId}'" : "tabela as '{$nomeId}'";
$db = new MySQL();
$selectFinal = "SELECT {$select} from tabelas_questionarios q WHERE q.tabela = 'surto'";
$db->ExecuteSQL($selectFinal);
$tabelasVigilancia = $db->ArrayResults();
$resultado = array();
foreach ($tabelasVigilancia as $tabelaVigilancia) {
$tabela = $tabelaVigilancia[$nomeId];
$db->ExecuteSQL("SELECT count(id) as total \n\t\t\t\t\t\t from {$tabela} q \n\t\t\t\t\t\t where q.data_hora BETWEEN '" . $_SESSION["data_inicio"] . " 00:00:00' AND '" . $_SESSION["data_final"] . " 23:59:59'\n\t\t\t\t\t\t and q.ativo = 1");
$total = $tabelasVigilancia = $db->ArrayResult();
$tabelaVigilancia[$nomeTotal] = $total['total'];
array_push($resultado, $tabelaVigilancia);
}
return $resultado;
}
示例2: MySQL
<?php
include "../php/class.MySQL.php";
$conn = new MySQL();
$sqlTotal = "SELECT count(id) as total FROM usuario_sentimento";
$conn->ExecuteSQL($sqlTotal);
$total = $conn->ArrayResult();
$totalTodos = (int) $total["total"];
$sql = "SELECT\n\t\t\tcount(us.id) as total, \n\t\t\tus.cidade_regiao_metro as nome,\n\t\t\t\n\t\t\tsum(us.campo1) as campo1, \n\t\t\tsum(us.campo2) as campo2, \n\t\t\tsum(us.campo3) as campo3,\n\t\t\tsum(us.campo4) as campo4,\n\t\t\tsum(us.campo5) as campo5,\n\t\t\tsum(us.campo6) as campo6,\n\t\t\tsum(us.campo7) as campo7,\n\t\t\tsum(us.campo8) as campo8,\n\t\t\tsum(us.campo9) as campo9,\n\t\t\tsum(us.campo10) as campo10,\n\t\t\tsum(us.campo11) as campo11,\n\t\t\tsum(us.campo12) as campo12\n\t\t\tFROM usuario_sentimento us\n\t\t\t\n\t\t\twhere us.sentimento in (3,4)\n\t\t\tand us.cidade_regiao_metro <> ''\n\t\t\t\n\t\t\tGROUP BY us.cidade_regiao_metro";
$conn->ExecuteSQL($sql);
$dados = $conn->ArrayResults();
$sql = "select * from sentimentos";
$conn->ExecuteSQL($sql);
$sentimentos = $conn->ArrayResults();
$campo1 = 0;
foreach ($dados as $dado) {
//$total+=$dado["total"];
$campo1 += $dado["campo1"];
$campo2 += $dado["campo2"];
$campo3 += $dado["campo3"];
$campo4 += $dado["campo4"];
$campo5 += $dado["campo5"];
$campo6 += $dado["campo6"];
$campo7 += $dado["campo7"];
$campo8 += $dado["campo8"];
$campo9 += $dado["campo9"];
$campo10 += $dado["campo10"];
$campo11 += $dado["campo11"];
$campo12 += $dado["campo12"];
}
//$totalTodos = $campo1 + $campo2 + $campo3 + $campo4 + $campo5 + $campo6 + $campo7 + $campo8 + $campo9 + $campo10;
示例3: json_encode
<?php
/**
* Amber
* @package principal
* @author César Martins
* @version 1.0
*/
include "class.MySQL.php";
include "class.Auth.php";
$conn = new MySQL();
$auth = new Auth();
header("Content-type: application/json; charset=utf-8");
$email = $_POST["email"];
$senha = $_POST["senha"];
$password = $auth->hashpass($senha);
//$activekey = $auth->randomkey(15);
if ($auth->validaCadastroLogin($password, $email)) {
$conn->ExecuteSQL("select * from usuarios where email = '{$email}'");
$lista = $conn->ArrayResult();
$resultado = array("status" => TRUE, "hash" => $hash);
} else {
$erros = "";
foreach ($auth->errormsg as $erro) {
$erros .= $erro;
}
$resultado['status'] = FALSE;
$resultado['mensagem'] = "Mensagem de erro. " . $erros . " " . time();
}
echo json_encode($resultado);
示例4: array
$dnciNome = "";
if ($row["dnci_id"] != 0) {
$sqlDnci = "select descricao from suspeita_dnci where id = " . $row["dnci_id"];
$conn->ExecuteSQL($sqlDnci);
$dnci = $conn->ArrayResults();
$dnciNome = $dnci[0]["descricao"];
} else {
$dnciNome = "";
}
$arraySexo = array('', 'Masculino', 'Feminino', 'Ignorado');
$sexoTipo = $arraySexo[$row["sexo"]];
$pais = array();
if ($row["pais"] != "") {
$sqlPais = "select * from paises where id = " . $row["pais"];
$conn->ExecuteSQL($sqlPais);
$pais = $conn->ArrayResult();
//var_dump($pais);
} else {
$pais["nome"] = "";
}
$estado = array();
if ($row["estado"] != "" or $row["estado"] != 0) {
$slqEstado = "select * from estado where id = " . $row["estado"];
$retorno = $conn->ExecuteSQL($slqEstado);
if ($conn->iRecords > 0) {
$estado = $conn->ArrayResult();
} else {
$estado["nome"] = "";
}
} else {
$estado["nome"] = "";
示例5: MySQL
<?php
/**
* Amber
* @package principal
* @author César Martins
* @version 1.0
*/
include "class.MySQL.php";
$conn = new MySQL();
$conn->ExecuteSQL("select * from usuario_sentimento where atualizado = 0");
$num_rows = $conn->ArrayResults();
$total = count($num_rows);
if ($total > 0) {
foreach ($num_rows as $row) {
$url = "http://maps.google.com/maps/api/geocode/json?latlng={$row['latitude']},{$row['longitude']}&sensor=false";
$data = json_decode(file_get_contents($url));
$cidade = $data->results[0]->address_components[3]->long_name;
$sql = "select * from cidade where nome like '{$cidade}'";
$conn->ExecuteSQL($sql);
$listaCidade = $conn->ArrayResult();
$sql = $conn->ExecuteSQL("update usuario_sentimento set atualizado = 1, cidade_id = {$listaCidade['id']} where id = {$row['id']}");
}
} else {
echo "Não ha dados a serem atualizados";
}
示例6: json_encode
<?php
/**
* Amber
* @package principal
* @author César Martins
* @version 1.0
*/
include "class.MySQL.php";
$db = new MySQL();
$db->ExecuteSQL("select * from users");
$users = $db->ArrayResults();
foreach ($users as $user) {
if ($user["ponto_monitoramento"] != 0) {
$sql = "select * from sub_unidades where id = " . $user["ponto_monitoramento"];
$db->ExecuteSQL($sql);
$unidade = $db->ArrayResult();
} else {
$unidade["nome"] = "";
}
$array[] = array("id" => $user["id"], "nome" => utf8_encode($user["username"]), "senha" => utf8_encode($user["password"]), "email" => utf8_encode($user["email"]), "ponto_monitoramento" => utf8_encode($user["ponto_monitoramento"]), "unidade" => utf8_encode($unidade["nome"]));
}
echo json_encode($array);
示例7: header
header("Cache-Control: max-age=0, no-cache, must-revalidate, proxy-revalidate");
header("Last-Modified: {$now} GMT");
// force download
header("Content-Type: application/force-download");
header("Content-Type: application/octet-stream");
header("Content-Type: application/download");
// disposition / encoding on response body
header("Content-Disposition: attachment;filename={$filename}");
header("Content-Transfer-Encoding: binary");
readfile($filename);
}
include "class.MySQL.php";
$conn = new MySQL();
$sql = "SELECT COUNT(us.id) as total FROM usuarios u\n\t\tINNER JOIN usuario_sentimento us ON us.usuario_id = u.id";
$conn->ExecuteSQL($sql);
$total = $conn->ArrayResult();
$sql = "SELECT total FROM total_usuario_sentimento";
$conn->ExecuteSQL($sql);
$total_sentimento = $conn->ArrayResult();
$total_sentimento["total"];
$sql = "UPDATE total_usuario_sentimento SET total= " . $total["total"];
//$conn->ExecuteSQL($sql);
$listagem = $total["total"] - $total_sentimento["total"];
//echo "<br>";
$titulo = array("ID_REG_SEQ", "ID_USUARIO", "APELIDO", "IDADE", "SEXO", "EMAIL", "IDIOMA", "DT_CADASTRO", "DT_REGISTRO_DIA", "DT_REGISTRO_HORA", "LOC_REGISTRO", "REGIAO", "EQUIPAMENTO", "LAT", "LONG", "STATUS", "FEBRE", "TOSSE", "DORGARGANTA", "FALTAR", "NAUSEA", "DIARREIA", "ARTRALGIA", "CEFALEIA", "HEMORRAGIA", "EXANTEMA", "CONTATO", "SERVSAUDE", "CADASTRO", "SINTOMA", "CONTAGEM", "SIND_DIA", "SIND_RES", "SIND_EXA", "ATUALIZA");
/*
$sql = "SELECT u.id, u.apelido, u.idade, u.sexo, u.email , u.data_hora,
u.hash, u.gcmid, u.idioma, us.data_cadastro, us.pontuacao,
us.latitude, us.longitude, c.nome, us.campo1, us.campo2, us.campo3,
us.campo4, us.campo5, us.campo6, us.campo7, us.campo8, us.campo9,
us.campo10, us.campo11, us.campo12
示例8: COUNT
break;
default:
require_once ENGINE_DIR . '/modules/index.php';
//if(LEVEL==1) //require_once ENGINE_DIR. '/modules/dashboard/list.php';
//require_once ENGINE_DIR. '/modules/dashboard/dashboard.php';
$thispage = "Главная";
break;
}
$tpl->assign("USERNAME", ADMINLOGIN);
$tpl->assign("USERID", ADMINID);
$tpl->assign("USERLEVEL", LEVEL);
$tpl->assign("HEAD", $HEAD);
$tpl->assign("END", $END);
$tpl->assign("AJAX", $AJAX);
$dataMySQL->ExecuteSQL("SELECT COUNT(*) from `" . DB_PREFIX . "users` WHERE 1 ;");
$allUSERS = $dataMySQL->ArrayResult();
$dataMySQL->ExecuteSQL("SELECT COUNT(*) FROM `" . DB_PREFIX . "users` WHERE `idc` > 4150;");
$cUSERS = $dataMySQL->ArrayResult();
$COUS = $cUSERS['COUNT(*)'] / $allUSERS['COUNT(*)'] * 100;
$NCOUS = $cUSERS['COUNT(*)'];
$ACOUS = $allUSERS['COUNT(*)'] - $cUSERS['COUNT(*)'];
$tpl->assign("COUS", $COUS);
$tpl->assign("COUS2", 100 - $COUS);
$tpl->assign("NCOUS", $NCOUS);
$tpl->assign("ACOUS", $ACOUS);
$tpl->assign("DATE", date("Y") . " " . $version);
$tpl->assign("IP", $_SERVER["REMOTE_ADDR"]);
$tpl->assign("module", $thispage);
//echo $dataMySQL->sLastQuery;
//if($ajaxer!==3 && LEVEL!=="1") $content.="<script>console.log('".LEVEL." {$thispage}');$(\".current\").html(\"{$thispage}\")</script>";
//if($ajaxer!==3 && LEVEL==1) $content.="<script>console.log('LEVEL ".LEVEL.": {$thispage}');$(\".current\").html(\"{$thispage} (query:".$dataMySQL->queryS.")\")</script>";
示例9: MySQL
include "../php/class.MySQL.php";
$conn = new MySQL();
if (isset($_SESSION["errormsg"])) {
if (is_array($_SESSION["errormsg"])) {
foreach ($_SESSION["errormsg"] as $list) {
echo utf8_decode($list) . "<br>";
}
} else {
echo $_SESSION["errormsg"];
}
unset($_SESSION["errormsg"]);
}
if (isset($_GET["alt"])) {
$sql = "SELECT * FROM users where id = " . $_GET["alt"];
$conn->ExecuteSQL($sql);
$dados = $conn->ArrayResult();
}
?>
<form action="cad_user01.php" method="post">
<table>
<tr>
<td>Nome</td>
<td><input name="username" type="text"></td>
</tr>
<tr>
<td>e-mail</td>
<td><input name="email" type="text"></td>
</tr>
<tr>
<td>Senha</td>
<td><input name="password" type="password"></td>
示例10: Auth
*/
include "bibliotecas/php/class.Auth.php";
$auth = new Auth();
$auth->notLogged("login.php");
include "bibliotecas/php/class.MySQL.php";
$db = new MySQL();
$db->ExecuteSQL("select * from paises");
$paises = $db->ArrayResults();
$db->ExecuteSQL("select * from sinais_sintomas order by sinais_desc");
$sinais_sintomas = $db->ArrayResults();
$db->ExecuteSQL("select * from hipotese_diagnostica order by hip_dia_desc");
$hipotese_diagnostica = $db->ArrayResults();
$session = $auth->sessioninfo($_COOKIE["auth_session"]);
$sql = "select ponto_monitoramento from users where id = " . $session['uid'];
$db->ExecuteSQL($sql);
$user = $db->ArrayResult();
$subUnidade = false;
$sqlComplemento = "";
if ($user["ponto_monitoramento"] > 0) {
$sql = "select id, unidade_id from sub_unidades where id = " . $user["ponto_monitoramento"];
$db->ExecuteSQL($sql);
$subUnidade = $db->ArrayResult();
$sqlComplemento .= " and id = " . $subUnidade["unidade_id"];
}
$sql = "select * from unidades where ativo = 1 {$sqlComplemento} order by nome";
$db->ExecuteSQL($sql);
$unidades = $db->ArrayResults();
?>
<!doctype html>
<html lang="en">
<head>
示例11: MySQL
require "mysql.class.php";
$m = new MySQL();
// API
// if(isset($_GET['addusers'])){
// $id = $_GET['trainid'];
// $num = $_GET['num'];
// // echo $num;
// $m->Update("trainData", array("numBheed" => $num), array("id" => $id));
// }
// if(isset($_GET['update'])){
// $id = $_GET['trainid'];
// $m->Select("trainData", array("numBheed"), array("id" => $id));
// $num = $m->ArrayResult();
// echo json_encode(Array("status"=>$num["numBheed"]));
// }
// REST API formation
if (isset($_GET)) {
if (!isset($_POST['num'])) {
$id = $_GET['trainid'];
$m->Select("trainData", array("numBheed"), array("id" => $id));
$num = $m->ArrayResult();
http_response_code(200);
echo json_encode(array("status" => $num["numBheed"]));
} else {
$id = $_GET['trainid'];
$num = $_POST['num'];
$m->Update("trainData", array("numBheed" => $num), array("id" => $id));
http_response_code(201);
return;
}
}