本文整理汇总了PHP中SaeMysql::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeMysql::getData方法的具体用法?PHP SaeMysql::getData怎么用?PHP SaeMysql::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeMysql
的用法示例。
在下文中一共展示了SaeMysql::getData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getNewAccessToken
/**
* 调用微信接口,重新获取access_token
* @return string
*/
private function _getNewAccessToken()
{
// 获取新的access_token
$apiUrl = sprintf($this->_apiUrl, APP_ID, APP_SECRET);
$newAccessToken = Curl::doCurl($apiUrl);
// 判断是否获取成功
if (!$newAccessToken['errcode'] && !empty($newAccessToken['access_token'])) {
// 将新获取的access_token更新到数据库
$c_time = time() - 200;
// 将获取到的时间提前一点
$mysql = new SaeMysql();
$sql = "SELECT `c_time`, `t_value` FROM `weixin_access_token`";
$data = $mysql->getData($sql);
//$data = DbPDO::table('weixin_access_token')->find();
if (!$data) {
// 首次插入
//DbPDO::table('weixin_access_token')->where(array('id'=>1))->add(array('c_time' => $c_time, 't_value' => $newAccessToken['access_token']));
$sql = "INSERT INTO `weixin_access_token` (`c_time`, `t_value`) VALUES ({$c_time}, " . $newAccessToken['access_token'] . ")";
} else {
// 修改
//DbPDO::table('weixin_access_token')->where(array('id'=>1))->save(array('c_time' => $c_time, 't_value' => $newAccessToken['access_token']));
$sql = "UPDATE `weixin_access_token` SET `c_time` = {$c_time} , `t_value` = " . $newAccessToken['access_token'] . " WHERE id = 1";
}
$mysql->runSql($sql);
$mysql->closeDb();
} else {
throw new Exception($newAccessToken['errcode'] . '-' . $newAccessToken['errmsg']);
}
return $newAccessToken['access_token'];
}
示例2: getPrintCode
static function getPrintCode($uid)
{
$mysql = new SaeMysql();
// 获取当前的 print code
$sql = "SELECT `print_code` FROM `printers` WHERE `uid` = '" . $uid . "'";
$old_code = $mysql->getVar($sql);
// 清空所有 print code 为 old code 的数据
$sql = "DELETE FROM `wx_images` WHERE `print_code` = '{$old_code}'";
$mysql->runSql($sql);
// 为了避免重复,先取出所有的print code
$sql = "SELECT `code` FROM `printers`";
$codes = $mysql->getData($sql);
// 生成新的print code
$new_code = mt_rand(1000, 9999);
$canAdd = false;
while (!$canAdd) {
$canAdd = true;
foreach ($codes as $codeItem) {
if ($codeItem['code'] == $new_code) {
$new_code = mt_rand(1000, 9999);
$canAdd = false;
break;
}
}
}
$sql = "UPDATE `printers` SET `code` = '" . $new_code . "' WHERE `uid` = '" . $uid . "'";
$mysql->runSql($sql);
$mysql->closeDb();
return $new_code;
}
示例3: getAstrosData
function getAstrosData()
{
$mysql = new SaeMysql();
$sql0 = "SELECT * FROM `" . tname("astro") . "` LIMIT 12";
$astros = $mysql->getData($sql0);
return $astros;
}
示例4: TimingTask
function TimingTask()
{
// load urls
$mysql = new SaeMysql();
$sql = "SELECT url FROM `url`";
$data = $mysql->getData( $sql );
$mysql->closeDb();
$queue = new SaeTaskQueue('task_queue_0_2');
$array = array();
for($i = 0; $i < sizeof($data); ++$i)
{
//$array[] = array('url'=>"http://urlwatcher.sinaapp.com/url_watch.php", "postdata"=>"target=".$data[$i], "prior"=>true);
$array[] = array('url'=>"http://urlwatcher.sinaapp.com/url_watch.php?target=" . $data[$i]["url"], "postdata"=>NULL, "prior"=>true);
}
$queue->addTask($array);
$ret = $queue->push();
if ($ret === false)
{
var_dump($queue->errno(), $queue->errmsg());
echo "Failed.";
}
else
{
echo "Success.";
print_r($array);
}
}
示例5: index
public function index()
{
$mysql = new SaeMysql();
$sql = "SELECT * FROM `scrawl` WHERE sid = 1";
$data = $mysql->getData($sql);
if ($mysql->errno() != 0) {
die("Error:" . $mysql->errmsg());
}
$this->assign('svg', $data[0]['data']);
$this->display();
}
示例6: get_book_count
function get_book_count($bookid)
{
if (empty($bookid)) {
return "数量异常";
}
$mysql = new SaeMysql();
$sql = "SELECT count FROM bookinfo WHERE id = '" . $bookid . "'";
$data = $mysql->getData($sql);
if (empty($data[0][0])) {
return "数量异常";
}
//取到总备货数量
$count1 = intval($data[0][0]);
$sql = "SELECT SUM(count) FROM sellinfo WHERE bookid = '" . $bookid . "' GROUP BY null";
$data = $mysql->getData($sql);
$count2 = 0;
if (!empty($data[0][0])) {
$count2 = intval($data[0][0]);
}
return strval($count1 - $count2);
}
示例7: ShowDiff
function ShowDiff($group_id, $from, $to, &$summary)
{
$mysql = new SaeMysql();
$sql = "SELECT url FROM `url` WHERE `group_id`=" . $group_id;
$urls = $mysql->getData( $sql );
$results = array();
for($i = 0; $i < sizeof($urls); ++$i)
{
$title = "";
$content_diff = "";
$sql_from = "SELECT content FROM `web_content` WHERE `url`='" . $urls[$i]['url'] . "' AND `date`='" . $from . "'";
$sql_to = "SELECT content FROM `web_content` WHERE `url`='" . $urls[$i]['url'] . "' AND `date`='" . $to . "'";
$content_from = $mysql->getVar( $sql_from );
$content_to = $mysql->getVar( $sql_to );
if (!$content_from || !$content_to)
{
array_attach($results, foutput('failed', $urls[$i]['url'], NULL, $summary));
}
else
{
if ($content_from !== $content_to)
{
$content_diff = GetFormattedDiff($content_from, $content_to);
if (is_string($content_diff))
{
array_attach($results, foutput('changed', $urls[$i]['url'], $content_diff, $summary));
}
else
{
array_attach($results, foutput('error', $urls[$i]['url'], NULL, $summary));
}
}
else
{
array_attach($results, foutput('identical', $urls[$i]['url'], NULL, $summary));
}
}
}
$mysql->closeDb();
return $results;
}
示例8: update
public function update(){
$query = "update toupiao set {$this->pingwei} = {$this->score} where keshi_name = '{$this->jiemu}'";
//echo $query;
$mysql = new SaeMysql();
$query_submit = "select didSubmit from score_pingwei where score like '{$this->pingwei}'";
$resultOfQuery_submit = $mysql->getData($query_submit);
//var_dump($this->pingwei);
//var_dump($resultOfQuery_submit);
if ($resultOfQuery_submit[0]["didSubmit"] > 1 || ($this -> score>100)|| ($this -> score<75)) {
# code...
$this->show_error();
}else{
$mysql->runSql( $query );
$mysql->closeDb();
$this->show_success();
}
}
示例9: SaeMysql
<?php
include 'header.php';
$mysql = new SaeMysql();
$sql = "select * from member";
$result = $mysql->getData($sql);
?>
<P>
<H2>New Income:</H2>
<P>
<form method="post" action="addIncome.php">
<table border="0">
<tr>
<td>amount:</td>
<td><input type="text" maxlength="255" size="30" name="amount" /><font color="red">(*number only)</font></td>
</tr>
<tr>
<td>from:</td>
<td>
<select name="memberId">
<?php
foreach ($result as $member) {
?>
<option value="<?php
echo $member[id];
?>
"/><?php
echo $member[name];
?>
</option>
<?php
示例10: time
<h1 align="center">医务科后台</h1>
<?php
//creat timestamp for record
$t = time();
$datestamp = date("Y-m-d H:i", $t);
echo "<h6 align='center'>现在时间:" . $datestamp . "</h6>";
//connect database
require_once 'conn.php';
//define openid
//getdata for person
$sql = "SELECT * FROM personalinformation_records WHERE 'check_rsk'='checked' ORDER BY id DESC";
$mysql = new SaeMysql();
//echo the result
echo "<table border='1' align='center' class='datalist'>";
$num = 0;
$query_sql = $mysql->getData($sql);
$numoflist = count($query_sql);
//$get_data =mysql_query("select * from waimai where class='{$class}' ORDER BY ord DESC");//查询
if ($numoflist <= 10) {
//如果总数小于等于10则全部生成
// makeList($get_data);
} else {
//总数大于10则分页
if (!isset($_GET['limit'])) {
$limitHead = 0;
} else {
$limitHead = $_GET['limit'];
}
//如果没有传递参数 那么初始化为0
$limitEnd = $limitHead + 10;
if ($limitEnd >= $numoflist) {
示例11: COUNT
}
//列表数据获取、分页
//计算总数
$count = $mysql->getVar("select COUNT(*) from class where status=1");
//如果数据表里有数据
if ($count) {
//每页显示记录数
$page_num = 2;
//如果无页码参数则为第一页
if ($page == 0) {
$page = 1;
}
//计算开始的记录序号
$from_record = ($page - 1) * $page_num;
//获取符合条件的数据
$class_list = $mysql->getData("select A.class_id,A.class_name,B.class_name as fclass_name\n from class A left join class B on A.class_fid=B.class_id where A.status=1 \n order by A.class_id desc \n limit {$from_record},{$page_num}");
//分页函数
$multi = multi($count, $page_num, $page, "class_manager.php");
}
?>
<!--页面名称-->
<h3>部门管理<a href="class_add.php">新增部门>></a></h3>
<!--列表开始-->
<table border=1>
<tr>
<td>序号</td><td>部门名称</td><td>所属上级</td><td>操作</td>
</tr>
<?php
if ($class_list) {
foreach ($class_list as $value) {
示例12: class
$sql = "update class set class_name='{$class_name}',class_fid='{$class_fid}',edittime='{$nowtime}'\n where class_id={$old_class_id}";
$mysql->runSql($sql);
} else {
//新增
$sql = "insert into class (class_name,class_fid,addtime,edittime,status) values ('{$class_name}',\n '{$class_fid}','{$nowtime}','{$nowtime}',1)";
$mysql->runSql($sql);
}
if ($mysql->errno() != 0) {
echo "<script>alert('" . $mysql->errmsg() . "');history.back();</Script>";
exit;
} else {
echo "<script>alert('操作成功!');location='class_add.php?class_id={$old_class_id}';</Script>";
exit;
}
}
$class_list = $mysql->getData("select class_name,class_id from class where status=1 order by class_fid asc");
?>
<!--页面名称-->
<h3>部门添加/修改<a href="class_manager.php">返回>></a></h3>
<!--表单开始-->
<form action="?" method="post" name="class_add" id="class_add" enctype="multipart/form-data">
<p>
部门名称:<input type="text" value="<?php
echo $class_value["class_name"];
?>
" name="class_name">
</p>
<p>
上级部门:
<select name="class_fid">
<option value="0">无上级部门</option>
示例13: SaeMysql
$mysql = new SaeMysql();
$pagesize = 10;
$sql = "select count(*) as num from income";
$myrow = $mysql->getLine($sql);
$num = $myrow["num"];
$pages = intval($num / $pagesize);
if ($num % $pagesize) {
$pages++;
}
if (empty($_GET['page'])) {
$page = 1;
} else {
$page = intval($_GET['page']);
}
$offset = $pagesize * ($page - 1);
$datas = $mysql->getData("select t.* from (select a.id,a.amount,a.member_id,a.time,b.name from income a ,member b where a.member_id = b.id order by a.time desc)t limit {$offset},{$pagesize}");
echo "<table>\n";
if (is_array($datas)) {
foreach ($datas as $data) {
?>
<tr>
<td align="right">amount:</td><td align="left"><B><?php
echo $data["amount"];
?>
</B></td>
<td align="right">from:</td><td align="left"><B><?php
echo $data["name"];
?>
</B></td>
<td align="right">time:</td><td align="left"><B><?php
echo $data["time"];
示例14: SaeMysql
<th>节目序号</th>
<th>节目名称</th>
<th>表演者</th>
<th>小组</th>
<th>总分</th>
<th>平均分</th>
<th>(去)总分</th>
<th>(去)平均分</th>
</tr>
<?php
//connect database
$mysql = new SaeMysql();
//mysqli_query($mysqli,"SET NAMES utf8");
$query = "select * from toupiao";
$result = $mysql->getData($query);
//var_dump($result);
$array_pingfeng = array();
//创建数组 存储qu平均分后的数组 记录id和平均分
for ($i = 0; $i < count($result); $i++) {
$row = $result[$i];
// var_dump($row);
$num_child_row = count($row) - 5;
$array_score = array_slice($row, 5);
//off 5 argues
sort($array_score);
$total_score = array_sum($array_score);
$total_pingjun_score = $total_score / $num_child_row;
array_pop($array_score);
array_shift($array_score);
$delete_score = array_sum($array_score);
示例15: makeTimu
function makeTimu($min, $max, $num, $i)
{
if ($num != 0 && $num > 0) {
# code...
$num = intval($num) + $i - 1;
$hasRan = array();
while ($i <= $num) {
srand((double) microtime() * 1000000);
$a = rand($min, $max);
//只要是随机的生成还没有存在于数组中
if (!in_array($a, $hasRan)) {
# code...
array_push($hasRan, $a);
$mysql = new SaeMysql();
//链接数据库
$sql = "select * from zhiShiJingDa_TiKu where id = {$a}";
$data = $mysql->getData($sql);
//var_dump($data);
//list($id,$timu,$xuanxiang01,$xuanxiang02,$xuanxiang03,$xuanxiang04,$daan) = $data[0];
//echo $timu;
echo '
<div class="panel">
<div class="panel-wrapper">
<h2 class="title">第' . ($i + 1) . '题</h2>
<p>
<span class="vote_title">' . $data[0]["timu"] . '</span>
<input name="timu[' . $i . '][timu_id]" type="text" hidden="true" value="' . $data[0]["id"] . '" />
<br/>
<br/>
<input name="timu[' . $i . '][timu_daan]" type="radio" value="A" />
<span>A、' . $data[0]["xuanxiang01"] . '</span></li>
<br/>
<input name="timu[' . $i . '][timu_daan]" type="radio" value="B" />
<span>B、' . $data[0]["xuanxiang02"] . '</span></li>
<br/>
<input name="timu[' . $i . '][timu_daan]" type="radio" value="C" />
<span>C、' . $data[0]["xuanxiang03"] . '</span>
</p>
</div>
';
$i++;
}
}
}
}