本文整理汇总了PHP中SqlHelper::query方法的典型用法代码示例。如果您正苦于以下问题:PHP SqlHelper::query方法的具体用法?PHP SqlHelper::query怎么用?PHP SqlHelper::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlHelper
的用法示例。
在下文中一共展示了SqlHelper::query方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getPlayer
private function getPlayer($id)
{
$st = new SqlHelper();
$sql = "SELECT game_id,account,pwd FROM tbl_player WHERE account='{$id}'";
$st->conn();
$result = $st->query($sql);
$st->close();
return $result;
}
示例2: checkOpenidEnable
private function checkOpenidEnable($openid)
{
$sql = "SELECT COUNT(openid) as count FROM tbl_rbkey WHERE openid = '{$openid}';";
$st = new SqlHelper();
$st->connDataBase(DB_URL, DB_USER, DB_PWD, DB_RBKEY);
$result = $st->query($sql);
$st->close();
if (+$result[0]['count'] == 0) {
return true;
}
return false;
}
示例3: checkRecordEnable
private function checkRecordEnable($openid)
{
$sql = "SELECT openid FROM tbl_feedback WHERE openid='{$openid}'";
$st = new SqlHelper();
$st->conn();
$result = $st->query($sql);
$st->close();
if (sizeof($result) == 0) {
return true;
}
return false;
}
示例4: getOrderId
/**
* 生成商户订单号
* @param $openid
*/
function getOrderId($mchBillno)
{
$temp = $mchBillno . date("Ymd");
$sql = "SELECT COUNT(*) AS count FROM tbl_rp_success";
$st = new SqlHelper();
$st->connDataBase(DB_WX_URL, DB_WX_USER, DB_WX_PWD, DB_WX_NAME);
$result = $st->query($sql);
$id = $result[0]['count'];
$count = strlen($id);
for ($i = $count; $i < 10; $i++) {
$temp .= '0';
}
$temp .= $id;
return $temp;
}
示例5: getOrderId
/**
* 生成商户订单号
* @param $openid
*/
private function getOrderId($mchBillno)
{
$temp = $mchBillno . date("Ymd");
$sql = "UPDATE tbl_gid SET last_id = last_id + 1;";
$st = new SqlHelper();
$st->connDataBase(DB_WX_URL, DB_WX_USER, DB_WX_PWD, DB_WX_NAME);
$result = $st->modify($sql);
if ($result) {
$sql = "SELECT last_id FROM tbl_gid;";
$result = $st->query($sql);
$id = $result[0]['last_id'];
$count = strlen($id);
for ($i = $count; $i < 10; $i++) {
$temp .= '0';
}
$temp .= $id;
} else {
die("get order wrong!!!!");
}
return $temp;
}
示例6: get_rank
/**
* 获取排行榜
* @param $params
* @param $res
*/
public function get_rank(&$params, &$res)
{
$st = new SqlHelper();
$data = array();
$data['self'] = 1;
$id = mysql_escape_string($params->id);
$sql = "SELECT COUNT(*) AS position FROM tbl_user WHERE total_score > (SELECT total_score FROM tbl_user WHERE id = '%s')";
$sql = sprintf($sql, $id);
$st->conn();
$result = $st->query($sql);
$data['self'] = $result[0]['position'];
$st->close();
$sql = "SELECT id,name,pic,total_score FROM tbl_user ORDER BY total_score DESC LIMIT 0,20";
$st->conn();
$result = $st->query($sql);
$st->close();
$data['list'] = $result;
$res['data'] = $data;
return $result;
}
示例7: get_rank
/**
* 获取排行榜
* @param $params
* @param $res
*/
public function get_rank(&$params, &$res)
{
$st = new SqlHelper();
$data = array();
$data['self'] = 1;
// $id = mysql_escape_string($params->id);
// $sql = "SELECT COUNT(*) AS position FROM tbl_user WHERE total_score > (SELECT total_score FROM tbl_user WHERE id = '%s')";
// $sql = sprintf($sql, $id);
// $st->conn();
// $result = $st->query($sql);
// $data['self'] = $result[0]['position'];
// $st->close();
$sql = "SELECT tbl_record.id, tbl_record.game_id, name, SUM(score) AS score FROM tbl_record LEFT JOIN tbl_user ON tbl_record.id = tbl_user.id GROUP BY id,game_id ORDER BY score DESC LIMIT 0,20";
$st->conn();
$result = $st->query($sql);
$st->close();
$data['list'] = $result;
$res['data'] = $data;
return $result;
}
示例8: SqlHelper
<?php
/**
* Created by PhpStorm.
* User: Jing
* Date: 2015/4/8
* Time: 23:21
*/
include './configs/define.php';
include "./utils/sql_helper.php";
$sqlHelper = new SqlHelper();
$sqlHelper->conn();
$result = $sqlHelper->query("SELECT * FROM tbl_statistic");
foreach ($result as $v) {
echo $v["content"] . ':' . $v["count"] . "<br/>";
}