本文整理汇总了PHP中SaeMysql类的典型用法代码示例。如果您正苦于以下问题:PHP SaeMysql类的具体用法?PHP SaeMysql怎么用?PHP SaeMysql使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SaeMysql类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: syncPhone
function syncPhone($id, $oldPhone, $newPhone)
{
$url = 'http://x.suzhoumaker.com/syncAction.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, "oldPhone=" . $oldPhone . "&newPhone=" . $newPhone);
// receive server response ...
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$server_output = curl_exec($ch);
curl_close($ch);
$syncAction = 3;
// further processing ....
$mysql = new SaeMysql();
if ($server_output == "OK") {
$syncAction = 0;
}
$sql = "UPDATE Member SET m_sync_action = " . $syncAction . ", m_updated_on=now() WHERE m_num=" . $id;
$mysql->runSql($sql);
if ($mysql->errno() != 0) {
die("Error:" . $mysql->errmsg());
} else {
//
}
$mysql->closeDb();
}
示例2: 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);
}
}
示例3: _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'];
}
示例4: getAstrosData
function getAstrosData()
{
$mysql = new SaeMysql();
$sql0 = "SELECT * FROM `" . tname("astro") . "` LIMIT 12";
$astros = $mysql->getData($sql0);
return $astros;
}
示例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: db_connect
/**
* Non-persistent database connection
*
* @access private called by the base class
* @return resource
*/
function db_connect()
{
if ($this->port != '') {
$this->hostname .= ':' . $this->port;
}
//---change---//
//return @mysql_connect($this->hostname, $this->username, $this->password, TRUE);
$t_saemysql = new SaeMysql();
$t_saemysql->setCharset($this->char_set);
$t_saemysql->setAuth($this->username, $this->password);
$t_saemysql->setPort($this->port);
return $t_saemysql;
}
示例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: 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);
}
示例9: 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();
}
}
示例10: check_admin
function check_admin()
{
if (isset($_COOKIE["admin_id"]) && isset($_COOKIE["admin_username"]) && isset($_COOKIE["admin_key"])) {
$id = intval($_COOKIE["admin_id"]);
$mysql = new SaeMysql();
$sql = "select * from `qs_admin` where `id`={$id}";
$row = $mysql->getLine($sql);
$mysql->closeDb();
if (3 == count($row)) {
$admin_username = $row["username"];
$admin_key = md5($row["password"] . $admin_username);
if ($_COOKIE["admin_key"] == $admin_key) {
return true;
} else {
return false;
}
} else {
return false;
}
} else {
return false;
}
}
示例11: header
<?php
header("content-type:text/html; charset=utf-8");
//require_once('../utility.php');
//require_once('../SaeMysql.php');
$mysql = new SaeMysql();
$sql = "INSERT INTO `WM_Log` (`page`) VALUES('A4-20160522')";
$mysql->runSql($sql);
$mysql->closeDb();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=10, user-scalable=yes">
<title>政策揭秘:美联储加息,你的恐惧为哪般?</title>
<meta name="description" content="Release by WorldMoney 2016.01.01">
<meta name="author" content="WorldMoney">
<link href="../bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- link href="../bootstrap/css/style.css" rel="stylesheet" -->
<link rel="stylesheet" href="../bootstrap/weui-master/dist/style/weui.css"/>
<link rel="stylesheet" href="../bootstrap/weui-master/dist/style/weui.min.css"/>
<link rel="stylesheet" href="../bootstrap/fancybox/jquery.fancybox.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../css/zhuanyangqian.css" />
<link rel="stylesheet" href="../css/A5.css" />
示例12: header
<?php
header("Content-Type:application/json;charset=UTF-8");
$code = $_GET['code'];
$poc = array("poc_1" => 1, "poc_2" => 2, "poc_3" => 3, "poc_4" => 4, "poc_5" => 5, "poc_6" => 6, "poc_7" => 7, "poc_8" => 8, "poc_9" => 9, "poc_10" => 10);
//参数 code验证
if (strpos($code, "||") == false) {
echo json_encode(array("status" => false, "msg" => "error code!"));
exit;
}
list($key, $value) = explode("||", $code);
if ($value != strtoupper(substr(md5("hongcha" . $key . "android"), 1, -1))) {
echo json_encode(array("status" => false, "msg" => "error code!"));
exit;
}
$mysql = new SaeMysql();
$sql = "select * from result where code ='" . $mysql->escape($code) . "'";
$data = $mysql->getData($sql);
$result = array();
if ($data) {
$tmpdata = $data[0];
foreach ($tmpdata as $key => $value) {
if ($key != "code" && $key != "id" && $key != "token" && $key != "ua") {
$result[$key] = intval($value);
}
}
echo json_encode(array("status" => true, "msg" => $result));
} else {
echo json_encode(array("status" => false, "msg" => "query empty!"));
}
$mysql->closeDb();
示例13: SaeMysql
<h6 align="center"><a href="admin_personal.php">查看评委打分</a> || <a href="admin_dafeng.php">固化打分</a> || <a href="result.php">观众最喜爱结果的评分</a></h6>
<table border='1' align='center'>
<tr>
<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;
示例14: die
<?php
$title = $_POST['title'];
$abstract = $_POST['abstract'];
$url = $_POST["url"];
$thumbnail = $_POST['thumbnail'];
$type = $_POST["type"];
$status = $_POST["status"];
$reviewer = $_POST["reviewer"];
$deliver = $_POST["deliver"];
$create_at = $_POST["create_at"];
$delete = $_POST["delete"];
if (empty($title)) {
die("{\"s_status\": \"ERROR\",\"s_message\": \"Empty data\",\"s_code\": 0}");
}
$mysql = new SaeMysql();
$sql = "INSERT INTO `android_digest_review`( `title`, `abstract`, `url`, `thumbnail`, `type`, `status`, `reviewer`, `deliver`, `create_at`, `delete`) " . "VALUES ('" . $title . "', '" . $abstract . "', '" . $url . "', '" . $thumbnail . "', '" . $type . "', '" . $status . "', '" . $reviewer . "', '" . $deliver . "', '" . $create_at . "', '" . $delete . "') ";
$mysql->runSql($sql);
if ($mysql->errno() != 0) {
die("{\"s_status\": \"ERROR\",\"s_message\": \"" . $mysql->errmsg() . "\",\"s_code\": 1}");
} else {
die("{\"s_status\": \"OK\",\"s_message\": \"\",\"s_code\": 200}");
}
$mysql->closeDb();
示例15: SaeMysql
<?php
if (defined('SAE_MYSQL_DB')) {
$sql = new SaeMysql();
} else {
require 'x/mysql.class.php';
}
$list = $sql->getData('SELECT * FROM imouto_article ORDER BY created DESC LIMIT 0,15');
$h = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">' . "\n" . '<channel>' . "\n" . ' <title>卜卜口</title>' . "\n" . ' <link>http://mouto.org/</link>' . "\n" . ' <description>94年少年。</description>' . "\n" . ' <lastBuildDate>' . date('D, d M Y H:i:s ', $list[0]['created']) . '</lastBuildDate>' . "\n" . ' <language>zh-CN</language>' . "\n";
foreach ($list as $p) {
$h .= ' <item>' . "\n" . ' <title><![CDATA[' . $p['title'] . ']]></title>' . "\n" . ' <link>http://mouto.org/#!' . $p['pid'] . '</link>' . "\n" . ' <category>' . $p['category'] . '</category>' . "\n" . ' <pubDate>' . date('D, d M Y H:i:s ', $p['created']) . '</pubDate>' . "\n" . ' <description><![CDATA[';
if ($p['cover']) {
$h .= '<p><img src="http://ww2.sinaimg.cn/large/' . $p['cover'] . '.jpg"></p>';
}
$h .= $p['text'] . ']]></description>' . "\n" . ' </item>' . "\n";
}
$h .= '</channel>' . "\n" . '</rss>';
header('Content-type: application/rss+xml;charset=utf-8');
exit($h);
file_put_contents('rss.xml', $h);