本文整理汇总了PHP中Mysql::query_array方法的典型用法代码示例。如果您正苦于以下问题:PHP Mysql::query_array方法的具体用法?PHP Mysql::query_array怎么用?PHP Mysql::query_array使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mysql
的用法示例。
在下文中一共展示了Mysql::query_array方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
function write($varname, $value)
{
if (!$this->valid_session()) {
return false;
}
$sql = "SELECT id FROM " . $this->session_vars_table . " WHERE name='" . $varname . "' AND session='" . $this->getSessionID() . "'";
$rez = Mysql::query_array($sql);
if (!isset($rez[0])) {
$rez = Mysql::query("INSERT INTO " . $this->session_vars_table . " \r\n\t\t \t\t\t(name,session,value) VALUES\r\n\t\t \t\t\t('" . $varname . "', '" . $this->getSessionID() . "', '" . $value . "')");
} else {
$mas["value"] = $value;
// $ids["session"] = $this->session;
$ids["name"] = $varname;
$sql = "UPDATE " . $this->session_vars_table . " SET `value` = '" . $value . "' WHERE name='" . $varname . "' AND session='" . $this->getSessionID() . "'";
Mysql::query($sql);
}
$GLOBALS[$varname] = $value;
$this->variables[$varname] = $value;
$this->s_touch();
}
示例2: json_encode
* Time: 下午5:17
*/
include '../Visitor.php';
$userId = getUserId();
$mysql = new Mysql();
if (isset($_POST['from'])) {
$from = $_POST['from'];
} else {
$from = 0;
}
if (isset($_POST['size'])) {
$size = $_POST['size'];
} else {
$size = 30;
}
$waiting = "";
if (isset($_POST['waiting']) && $_POST['waiting']) {
$sendTime = time() - 10 * 60;
$waiting = " and timestamp>{$sendTime} ";
}
$sql = "SELECT *,ft.id as footprintId FROM footprint ft inner join foot f WHERE ft.footId=f.id and ft.userId={$userId} order by timestamp desc limit {$from},{$size}";
if (isset($sendTime)) {
$sql = "SELECT *,ft.id as footprintId FROM footprint ft inner join foot f WHERE ft.footId=f.id and ft.userId={$userId} {$waiting}order by timestamp desc limit {$from},{$size}";
}
$foot_array = $mysql->query_array($sql);
foreach ($foot_array as $v) {
$footprint = new FootPrint($v);
$footPrints[] = $footprint;
}
$res = [ok => 1, data => $footPrints];
echo json_encode($res);
示例3: json_encode
<?php
/**
* Created by PhpStorm.
* User: shaoting
* Date: 15/7/26
* Time: 下午9:57
*/
include "../Visitor.php";
$userId = getUserId();
$mysql = new Mysql();
$result = $mysql->select("*", "`user_regular`", "`user_id`", "{$userId}");
if ($result) {
//echo "SELECT * FROM user_regular u inner join regular r WHERE r.id=u.regular_id and u.user_id={$userId}";
$regular_array = $mysql->query_array("select * from (SELECT u.*,r.host,r.threshold FROM user_regular u inner join regular r WHERE r.id=u.regular_id and u.user_id={$userId} order by time desc ) a group by host");
} else {
//echo "select * from (SELECT *,count(r.id) count FROM user_regular u inner join regular r WHERE r.id=u.regular_id group by r.id)a limit 10";
//无规则时返回大家用的最多的规则
$regular_array = $mysql->query_array("select * from (SELECT u.*,r.host,r.threshold,count(r.id) count FROM user_regular u inner join regular r WHERE r.id=u.regular_id group by r.id)a group by host order by time desc limit 10");
}
foreach ($regular_array as $v) {
$regular = new Regular($v);
$regulars[] = $regular;
}
$res = [ok => 1, data => $regulars];
echo json_encode($res);