本文整理汇总了PHP中SaeMysql::runSql方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeMysql::runSql方法的具体用法?PHP SaeMysql::runSql怎么用?PHP SaeMysql::runSql使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeMysql
的用法示例。
在下文中一共展示了SaeMysql::runSql方法的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: SaeMysql
<?php
$sql_update = "UPDATE personalinformation_records SET `check` = '{$_GET['value']}' WHERE `id` = {$_GET["id"]}";
$mysql = new SaeMysql();
$do = $mysql->runSql($sql_update);
echo '<script language="javascript">
window.location.href="admin.php";
</script>';
$mysql->closeDb();
示例3: die
if ($install == "1") {
echo "<h1>警告</h1>";
echo "<h3>版本" . $_SERVER['HTTP_APPVERSION'] . "已完成安装!请删除/install/目录!</h3>";
echo "<h3>如果重新安装请先删除storage内的 saestor_" . $_SERVER['HTTP_APPVERSION'] . "/data/install.lock 文件</h3>";
} else {
// 判断是否已经初始化了storage,mc,mysql
if (is_storage() && is_mc() && is_mysql()) {
$fp = @fopen(dirname(__FILE__) . "/ecshop4sae.sql", "r") or die("不能打开SQL文件 {$file_name}");
//打开文件
if ($fp) {
$mysql = new SaeMysql();
echo "正在执行导入操作:";
while ($SQL = GetNextSQL()) {
$SQL = str_replace("`ecs_", "`" . TABLE_PREFIX, $SQL);
// echo $SQL."<BR/>";
if (!$mysql->runSql($SQL)) {
echo "执行出错:" . $mysql->errmsg() . "";
echo "SQL语句为:" . $SQL . "";
exit;
}
}
echo "导入完成<br/>";
echo "<h1>安装成功</h1>";
echo "点击<a href='/admin'>/admin</a> 进入后台,管理员帐号为admin 密码为123<br/><br/><h2>注意</h2>为确保安全请登入后台后修改密码!并使用svn删除/install目录!";
@fclose($fp);
$s = new SaeStorage();
$s->write(SAESTOR_NAME, "saestor_" . $_SERVER['HTTP_APPVERSION'] . "/data/install.lock", '1');
} else {
echo "<h1>错误</h1>";
echo "ecshop4sae.sql文件不存在!";
}
示例4: SaeMysql
<?php
include 'header.php';
$mysql = new SaeMysql();
$mysql->runSql("set names 'utf8'");
$sql = "select * from member";
$members = $mysql->getData($sql);
echo "<table>\n";
foreach ($members as $member) {
?>
<tr>
<td align="right">name:</td><td align="left"><B><?php
echo $member["name"];
?>
</B></td>
<td align="right">updateTime:</td><td align="left"><B><?php
echo $member["updatetime"];
?>
</B></td>
</tr>
<tr>
<td colspan="2">balance:<FONT <?php
if ($member["balance"] < 0) {
echo "color=\"red\"";
}
?>
><?php
echo $member["balance"];
?>
</FONT></td>
</tr>
示例5: use
if (is_bool($name)) {
$name = "";
sae_log("名字不存在" . $name);
}
$mysql->closeDb();
return Message::make('news')->items(function () use($name, $welcome) {
return $welcome($name);
});
}
});
//取消关注
$server->on('event', 'unsubscribe', function ($event) {
sae_log("用户取消关注: " . $event->openid);
$mysql = new SaeMysql();
$signup = "update wechat_user set isFollow = 0, unfollowTime = '" . date("Y/m/d-H:i:s") . "'WHERE\n openid='{$event->FromUserName}'";
$mysql->runSql($signup);
sae_log($mysql->errno() . "-" . $mysql->errmsg());
$mysql->closeDb();
});
//文字消息处理,调用图灵机器人
$server->on('message', 'text', function ($message) use($welcome) {
//四六级查分-备份考号
return handleText($message->Content, $message->FromUserName, $welcome);
});
//图片处理,调用微软API
$server->on('message', 'image', function ($image) {
$picUrl = $image->PicUrl;
$face = new Face($picUrl);
$info = $face->info;
if ($info !== false) {
$amount = count($info);
示例6: weatherAPI
$help .= "\n" . '#[xx]内的内容xx是指你发送给小u的';
// 接收位置
if ($type == 'location') {
$uriID = 'oTHwbt_9H0QVjJn8AdI-fmkHdKgM';
$X = $xml->Location_X;
$Y = $xml->Location_Y;
$sql = "SELECT Location_X,Location_Y FROM info WHERE FromUserName='{$uriID}'";
$sqlback = $mysql->getData($sql);
$pre_X = $sqlback[0]['Location_X'];
$pre_Y = $sqlback[0]['Location_Y'];
$wData = weatherAPI($X, $Y);
//天气查询
$distance = W::getDistance($X, $Y, $pre_X, $pre_Y);
//计算距离
if ($openid == $uriID) {
$mysql->runSql("UPDATE info SET Location_X='{$X}',Location_Y='{$Y}' WHERE FromUserName='{$uriID}'");
$data = '主人的位置已上传' . "\n" . 'X:' . $X . "\n" . 'Y:' . $Y . "\n" . '相距上次位置' . $distance . 'km';
} else {
$data = '哦哦,你和我的距离只有' . $distance . 'km哟';
}
$data .= "\n" . '------------------------------' . "\n" . $wData;
} elseif ($type == 'text') {
$result = $mysql->getData("SELECT * FROM python WHERE FromUserName='{$openid}'");
//python console
if ($result[0]['state'] == 1) {
if ($content == 'quit') {
$mysql->runSql("UPDATE python SET state=0 WHERE FromUserName='{$openid}'");
$data = '已退出Python终端...';
} else {
$data = python($content);
}
示例7: matchEngine
//.........这里部分代码省略.........
for ($i = 0; $i < 5; $i++) {
array_push($data, array('title' => $wiki[$i]['title'] . "\n" . '------------------------------------------', 'note' => $wiki[$i]['snippet'], 'cover' => '', 'link' => 'http://zh.wikipedia.org/wiki/' . $wiki[$i]['title']));
}
break;
case 'doubanMovie1':
$m = doubanMovies($matches[2]);
$data = array(array('title' => $m[0]['title'], 'note' => $m[0]['year'] . ' ' . $m[0]['average'], 'cover' => $m[0]['images']->large, 'link' => $m[0]['alt']));
for ($i = 1; $i <= 5; $i++) {
array_push($data, array('title' => $m[$i]['title'], 'note' => '又名:' . $m[$i]['original_title'] . "\n" . '上映日期:' . $m[$i]['year'] . "\n" . '评价:' . $m[$i]['average'], 'cover' => $m[$i]['images']->small, 'link' => $m[$i]['alt']));
}
break;
case 'doubanMovie2':
$m = doubanMovies($matches[2]);
$movie = doubanMovie($m[0]['id']);
$xinxi = '又名:';
foreach ($movie['aka'] as $value) {
$xinxi .= $value . '/';
}
$xinxi .= "\n" . '上映日期:' . $movie['year'] . "\n" . '制片国家:';
foreach ($movie['countries'] as $value) {
$xinxi .= $value . '/';
}
$xinxi .= "\n" . '类型:';
foreach ($movie['genres'] as $value) {
$xinxi .= $value . '/';
}
$xinxi .= "\n" . '评价:' . $movie['average'];
$data = array(array('title' => $movie['title'], 'cover' => $movie['images'], 'link' => $movie['mobile_url']), array('note' => $xinxi, 'link' => $movie['mobile_url']), array('title' => '简介', 'note' => $movie['summary'], 'link' => $movie['mobile_url']), array('title' => '导演', 'note' => $movie['directors'][0]->name, 'cover' => $movie['directors'][0]->avatars->small, 'link' => $movie['directors'][0]->alt), array('title' => '主演', 'note' => $movie['casts'][0]->name, 'cover' => $movie['casts'][0]->avatars->small, 'link' => $movie['casts'][0]->alt));
break;
case 'doubanBook1':
$b = doubanBooks($matches[2]);
$data = array(array('title' => $b[0]['title'], 'note' => $b[0]['author'][0] . ' ' . $b[0]['average'], 'cover' => $b[0]['images']->large, 'link' => $b[0]['alt']));
for ($i = 1; $i <= 4; $i++) {
array_push($data, array('title' => $b[$i]['title'], 'note' => '作者:' . $b[$i]['author'][0] . "\n" . '出版社:' . $b[$i]['publisher'] . "\n" . '出版日期:' . $b[$i]['pubdate'] . "\n" . '价格:' . $b[$i]['price'] . "\n" . '评价:' . $b[$i]['average'] . "\n" . '导言:' . $b[$i]['summary'], 'cover' => $b[$i]['images']->small, 'link' => $b[$i]['alt']));
}
break;
case 'doubanBook2':
$b = doubanBooks($matches[2]);
$bk = doubanBook($b[0]['id']);
$data = array(array('title' => $bk['title'], 'cover' => $bk['images'], 'link' => $bk['alt']), array('note' => '作者:' . $bk['author'][0] . "\n" . '出版社:' . $bk['publisher'] . "\n" . '出版日期:' . $bk['pubdate'] . "\n" . '价格:' . $bk['price'] . "\n" . '评价:' . $bk['average'], 'link' => $bk['alt']), array('title' => '导言:', 'note' => $bk['summary'], 'link' => $bk['alt']));
break;
case 'doubanMusic1':
$m = doubanMusics($matches[2]);
$data = array(array('title' => $m[0]['title'], 'note' => $m[0]['average'], 'cover' => $m[0]['image'], 'link' => $m[0]['alt']));
for ($i = 1; $i <= 4; $i++) {
array_push($data, array('title' => $m[$i]['title'], 'note' => '作者:' . $m[$i]['author'][0]->name . "\n" . '出版社:' . $m[$i]['publisher'][0] . "\n" . '出版日期:' . $m[$i]['pubdate'][0] . "\n" . '表演者:' . $m[$i]['singer'][0] . "\n" . '评价:' . $m[$i]['average'] . "\n" . '类型:' . $m[$i]['version'][0], 'cover' => $m[$i]['image'], 'link' => $m[$i]['alt']));
}
break;
case 'doubanMusic2':
$m = doubanMusics($matches[2]);
$mu = doubanMusic($m[0]['id']);
$data = array(array('title' => $mu['title'], 'cover' => $mu['image'], 'link' => $mu['mobile_link']), array('note' => '表演者:' . $mu['singer'][0] . "\n" . '专辑类型:' . $mu['version'][0] . "\n" . '发行时间:' . $mu['pubdate'][0] . "\n" . '作者:' . $mu['author'][0]->name . "\n" . '出版者:' . $mu['publisher'][0] . "\n" . '评价:' . $mu['average'], 'link' => $mu['mobile_link']), array('title' => '简介:', 'note' => $mu['summary'], 'link' => $mu['mobile_link']));
break;
case 'moments1':
$moment = $matches[2];
$time = time();
$date = date("Y-m-d H:i:s", time());
$mysql = new SaeMysql();
$res = $mysql->getData("SELECT alias FROM info WHERE FromUserName='{$openid}'");
$alias = $res[0]['alias'];
if (!$alias) {
$data = '由于你是第一次发送动态,请按照以下格式回复基本信息:' . "\n" . '昵称:+你的昵称';
} else {
$mysql->runSql("INSERT INTO moments(FromUserName,alias,moment,time,date) VALUES ('{$openid}','{$alias}','{$moment}',{$time},'{$date}')");
$data = "发送成功,你可以现在上传一张图片作为配图,当然也可以不上传啦。回复[动态]查看";
}
break;
case 'moments2':
$alias = $matches[2];
$mysql = new SaeMysql();
$res = $mysql->getData("SELECT * FROM info");
$num = 0;
while ($res[$num]) {
if ($alias == $res[$num]['alias'] || $alias == '小u' || $alias == 'urinx') {
$t = 1;
} elseif ($openid == $res[$num]['FromUserName']) {
$u = 1;
}
$num++;
}
if ($t) {
$data = '该用户名已被注册,请重新输入';
} else {
if ($u) {
$mysql->runSql("UPDATE info SET alias='{$alias}' WHERE FromUserName='{$openid}'");
$data = '更改成功!';
} else {
$mysql->runSql("INSERT INTO info(FromUserName,alias) VALUES ('{$openid}','{$alias}')");
$data = '注册成功!';
}
}
break;
default:
# code...
break;
}
}
}
return $data;
}
示例8: setcookie
window.history.go(-1);
</script>
<?php
}
}
if ("logout" == $cmd) {
setcookie("user_id", "", time() - 3600, "/");
setcookie("user_username", "", time() - 3600, "/");
setcookie("user_key", "", time() - 3600, "/");
?>
<script type="text/javascript">
window.location.href="../../index.php";
</script>
<?php
}
if ("submit-paper" == $cmd) {
$mysql = new SaeMysql();
$id = intval($_COOKIE["user_id"]);
$sql = "update `qs_user` set `lock`=1 where `id`={$id}";
$rowt = $mysql->runSql($sql);
$mysql->closeDb();
setcookie("user_id", "", time() - 3600, "/");
setcookie("user_username", "", time() - 3600, "/");
setcookie("user_key", "", time() - 3600, "/");
?>
<script type="text/javascript">
alert('交卷成功,请离开考场');
window.location.href="../../index.php";
</script>
<?php
}
示例9: update
public function update()
{
$check_caozuo = "select caozuo from toupiao where id ={$this->jiemu}";
$query = "update toupiao set {$this->pingwei} = {$this->score} where id = {$this->jiemu}";
//echo $query;
$mysql = new SaeMysql();
$mysql_caozuo = new SaeMysql();
$result_check = $mysql_caozuo->getData($check_caozuo);
//var_dump($result_check);
if ($result_check[0]['caozuo'] == "1") {
# code...
$result = $mysql->runSql($query);
if ($result) {
$this->show_success();
} else {
$this->show_fail();
}
} else {
$this->show_error();
}
//$result->free();
//$mysqli->close();
}
示例10: json_encode
<?php
header("Content-Type:application/json;charset=UTF-8");
$token = $_GET['token'];
$ua = $_SERVER['HTTP_USER_AGENT'];
if (empty($token) || strlen($token) < 10) {
echo json_encode(array("status" => false, "msg" => "token不正确"));
exit;
}
$mysql = new SaeMysql();
$sql = "select id,code from result where token ='" . $mysql->escape($token) . "'";
$data = $mysql->getData($sql);
if (!$data) {
$code = date("YmdHis") . "||" . strtoupper(substr(md5("hongcha" . date("YmdHis") . "android"), 1, -1));
$insert_sql = "insert into result (`code`,`token`, `ua`) values ('" . $mysql->escape($code) . "','" . $mysql->escape($token) . "','" . $mysql->escape($ua) . "')";
$mysql->runSql($insert_sql);
if ($mysql->errno() != 0) {
echo json_encode(array("status" => false, "msg" => "mysql error!"));
exit;
}
} else {
$code = $data[0]['code'];
}
$mysql->closeDb();
//$code = date("YmdHis")."||".strtoupper(substr(md5("hongcha".date("YmdHis")."android"),1,-1));
echo json_encode(array("status" => true, "code" => $code));
示例11: upuserlock
function upuserlock($lock, $username)
{
$mysql = new SaeMysql();
$sql = "UPDATE `wx_users` SET `lock` = '{$lock}' WHERE `openid` = '{$username}'";
$mysql->runSql($sql);
if ($mysql->errno() != 0) {
die("Error:" . $mysql->errmsg());
}
$mysql->closeDb();
}
示例12: _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'];
}
示例13: SaeMysql
if (!empty($huojiang)) {
for ($x = 0; $x < count($huojiang); $x += 2) {
$str_huojiang .= $huojiang[$x] . "年,荣获《" . $huojiang[$x + 1] . "》。\n";
}
}
$chenguo = $str_lunwen + $str_huojiang;
//##########################################################################################
$sql_check = "SELECT * FROM personalinformation_records where gonghao like '{$_POST['gonghao']}'";
$sql = "INSERT INTO personalinformation_records (`uuid`, `gonghao`,`name`, `gender`, `xueli`,\n`zhicheng`, `xuewei`, `zhiwu`, `zhanke`, `shanchang`, `jianli`,`yanjue`,`chengguo`, `check_rsk`, `check_ywk` )\nVALUES('{$_POST['uuid']}','{$_POST['gonghao']}','{$_POST['name']}','{$_POST['gender']}','{$_POST['xueli']}',\n'{$_POST['zhicheng']}','{$_POST['xuewei']}','{$_POST['zhiwu']}','{$_POST['zhanke']}','{$_POST['shanchang']}',\n'{$_POST['jianli']}','{$_POST['yanjue']}','{$_POST['chengguo']}','unchecked','unchecked')";
$sql_update = "UPDATE personalinformation_records SET `name` = '{$_POST['name']}', `gender`='{$_POST['gender']}',\n`xueli`='{$_POST['xueli']}', `zhicheng`='{$_POST['zhicheng']}',\n`xuewei`='{$_POST['xuewei']}',`zhiwu`='{$_POST['zhiwu']}',`zhanke`='{$_POST['zhanke']}',\n`shanchang`='{$_POST['shanchang']}',`jianli`='{$_POST['jianli']}','{$_POST['yanjue']}','{$_POST['chengguo']}' WHERE\n`uuid` LIKE '{$_POST['uuid']}'";
//echo $sql;
//include("conn.php");
$mysql = new SaeMysql();
if ($_POST["from"] == "fromItem") {
$sql_update = "UPDATE personalinformation_records SET `name` = '{$_POST['name']}', `gender`='{$_POST['gender']}',\n`xueli`='{$_POST['xueli']}', `zhicheng`='{$_POST['zhicheng']}',\n`xuewei`='{$_POST['xuewei']}',`zhiwu`='{$_POST['zhiwu']}',`zhanke`='{$_POST['zhanke']}',\n`shanchang`='{$_POST['shanchang']}',`jianli`='{$_POST['jianli']}','{$_POST['yanjue']}','{$_POST['chengguo']}' WHERE `uuid` LIKE '{$_POST['uuid']}'";
$mysql->runSql($sql_update);
} else {
$chaxun = $mysql->getData($sql_check);
//echo $chaxun->num_rows;
if (empty($chaxun)) {
//为空,第一次提交
$mysql->runSql($sql);
//echo "location:index.php?name={$_POST['name']}&uuid={$_POST['uuid']}";
echo '<script language="javascript">
alert("提交成功!");
window.location.href="login.html";
</script>';
} else {
//非空,更新之
//echo $sql_update;
//echo "location:index.php?name={$_POST['name']}&uuid={$_POST['uuid']}";
示例14: SaeMysql
echo $nameErr;
?>
");
</script>
<?php
} else {
$is_name = true;
}
if ($is_examid && $is_name) {
$_SESSION['examid'] = $examid;
$_SESSION['name'] = $name;
//更新数据库
$mysql = new SaeMysql();
$update = "insert into cet (examid,name,openid) VALUES ('{$examid}','{$name}','{$openid}')";
$updata_wx = "update wechat_user set name='{$name}' WHERE openid='{$openid}'";
$bool = $mysql->runSql($update);
$bool = $mysql->runSql($updata_wx);
if (!$bool) {
sae_log("插入考号姓名出错" . $mysql->errmsg());
}
$mysql->closeDb();
//跳转
header("Location:http://5.n1gel.sinaapp.com/cet_result.php");
}
}
//endregion
?>
<!doctype>
<html lang="zh">
<head>
<meta charset="UTF-8">
示例15: json_encode
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;
}
$id = 0;
$mysql = new SaeMysql();
$sql = "select id from result where code ='" . $mysql->escape($code) . "'";
$data = $mysql->getData($sql);
if (!$data) {
// $insert_sql = "insert into result (`code`, `ua`) values ('" .$mysql->escape($code) . "','". $mysql->escape($ua) ."')";
//$mysql->runSql($insert_sql);
//if ($mysql->errno() != 0){
// echo json_encode(array("status" => false, "msg" => "mysql error!"));
// exit();
//}
//$id = $mysql->lastId();
echo json_encode(array("status" => false, "msg" => "请刷新后重试!"));
exit;
} else {
$id = intval($data[0]["id"]);
}
$update_sql = "update result set {$poc[$poc_suc]} = 1 where id = {$id} and code ='" . $mysql->escape($code) . "'";
$mysql->runSql($update_sql);
if ($mysql->error() != 0) {
echo json_encode(array("status" => false, "msg" => "update error!"));
exit;
}
$mysql->closeDb();
echo json_encode(array("status" => true, "msg" => "update success!"));
exit;