本文整理汇总了PHP中SaeMysql::errno方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeMysql::errno方法的具体用法?PHP SaeMysql::errno怎么用?PHP SaeMysql::errno使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SaeMysql
的用法示例。
在下文中一共展示了SaeMysql::errno方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mysqlc
function mysqlc($content)
{
$mysql = new SaeMysql();
if ($content == 'help') {
$data = 'Select' . "\n" . 'Insert' . "\n" . 'Update' . "\n" . 'Delete' . "\n" . 'Create' . "\n" . 'Drop' . "\n" . 'Index' . "\n" . 'Alter';
} else {
if (preg_match('#^(select)#i', $content)) {
$sqlresult = $mysql->getData($content);
if ($mysql->errno() != 0) {
$data = "Error:" . $mysql->errmsg();
} else {
$data = 'mysql> ' . $content . "\n" . '-----------------' . "\n";
foreach ($sqlresult as $row) {
foreach ($row as $key => $value) {
$data .= $key . ':' . $value . "\n";
}
$data .= '------------------' . "\n";
}
}
} else {
$mysql->runSql($content);
if ($mysql->errno() != 0) {
$data = "Error:" . $mysql->errmsg();
}
}
}
return $data;
}
示例2: 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();
}
示例3: 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();
}
示例4: intval
$old_class_id = intval($old_class_id);
$class_name = string::un_script_code($class_name);
$class_fid = intval($class_fid);
//默认参数
$nowtime = date("Y/m/d H:i:s", time());
//如果是修改
if ($old_class_id) {
//修改部门名称、所属、更新时间
$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
示例5: runquery
<?php
$lvyi_db = new SaeMysql();
//install
$sql = file_get_contents('./db.sql');
//do
runquery($sql);
//report
if ($lvyi_db->errno() != 0) {
die("Error:" . $lvyi_db->errmsg());
}
$lvyi_db->closeDb();
//include success template
function runquery($sql)
{
global $lvyi_db;
$sql = str_replace("\r", "\n", $sql);
$ret = array();
$num = 0;
foreach (explode(";\n", trim($sql)) as $query) {
$queries = explode("\n", trim($query));
foreach ($queries as $query) {
$ret[$num] .= $query[0] == '#' || $query[0] . $query[1] == '--' ? '' : $query;
}
$num++;
}
unset($sql);
$strtip = "";
foreach ($ret as $query) {
$query = trim($query);
if ($query) {
示例6: use
$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);
$description = "";
示例7: VALUES
$examid = $mysql->getVar($examid);
//数据库保存的openid
$openid_db = $query['openid'];
$name = $query['name'];
$_SESSION['examid'] = $examid;
$_SESSION['name'] = $name;
//var_dump($examid);
//var_dump($mysql->getLine($query));
//var_dump($mysql->getVar($query));
//sae_log(json_encode($openid . "-" . $examid));
//用户尚未注册
if (empty($openid_db)) {
$signup = "INSERT INTO wechat_user (openid) VALUES ('{$openid}') ";
$bool = $mysql->runSql($signup);
if (!$bool) {
echo $debug = sprintf("注册失败 %d : %s", $mysql->errno(), $mysql->errmsg());
sae_log($debug);
} else {
// echo "你已成功注册" . "<br/>";
// echo "即将跳转到备份的页面";
// echo "if 111111";
//跳到填写考号和姓名的页面
header("Location:http://5.n1gel.sinaapp.com/cet_query.php");
//填写之后,更新session,更新数据库
}
//用户已注册,为备份考号和姓名
} elseif (empty($examid)) {
// echo "即将跳转到备份的页面";
// echo "if 222222222";
header("Location:http://5.n1gel.sinaapp.com/cet_query.php");
//页面获取exanid和姓名直接查询,将查询结果存到数据库并显示到页面,生成一个模板图片,让用户保存
示例8: intval
require_once "../../config/saemysql.class.php";
$uid = intval($_COOKIE["user_id"]);
$qid = intval($_POST["qid"]);
$post_answer = trim($_POST["answer"]);
$sql = "select * from `judge_answer` where `user_id`={$uid} and `ques_id`={$qid}";
$mysql = new SaeMysql();
$row = $mysql->getLine($sql);
$mysql->closeDb();
if (false != $row) {
// echo "执行更新操作";
$sql = "update `judge_answer` set `answer`={$post_answer} where `user_id`={$uid} and `ques_id`={$qid}";
$mysql = new SaeMysql();
$mysql->runSql($sql);
if ($mysql->errno() == 0) {
echo "答案更新成功";
} else {
echo "答案更新失败,请重试";
}
$mysql->closeDb();
} else {
// echo "执行插入操作";
$sql = "insert into `judge_answer` (`user_id`,`ques_id`,`answer`) values ({$uid},{$qid},{$post_answer}) ";
$mysql = new SaeMysql();
$mysql->runSql($sql);
if ($mysql->errno() == 0) {
echo "答案提交成功";
} else {
echo "答案提交失败,请重试";
}
$mysql->closeDb();
}
示例9: DBinsert
function DBinsert($userid, $username)
{
$mysql = new SaeMysql();
$sql_1 = "SELECT * FROM `users` WHERE `weiboid` =" . $userid;
//$sql_1 = "SELECT * FROM `users` LIMIT 10";
$data = $mysql->getData($sql_1);
if ($mysql->errno() != 0) {
die("Error_1:" . $mysql->errmsg());
}
if (count($data) == 0) {
$sql_2 = "INSERT INTO `users` ( `weiboid` , `weiboname` ) VALUES ('" . $userid . "','" . $username . "') ";
$mysql->runSql($sql_2);
} else {
foreach ($data as $v1) {
echo '<p/>';
echo 'weiboname: ' . $v1['weiboname'] . '<br/>';
}
}
$sql_3 = "SELECT `pynames` FROM `users` WHERE `weiboid` =" . $userid;
$data = $mysql->getData($sql_3);
if ($mysql->errno() != 0) {
die("Error_3:" . $mysql->errmsg());
}
if (checkArray($data)) {
echo 'pyname is null <br/>';
} else {
//echo "length of data=".count($data).'<br/>';
foreach ($data as $v1) {
//echo '<p/>';
//echo 'pynames: ' . $v1['pynames'] . '<br/>';
$ps = explode(",", $v1['pynames']);
//echo "length of ps=".count($ps).'<br/>';
foreach ($ps as $v2) {
//echo '<p/>';
//echo 'pynames: ' . $v2 . '<br/>';
$sql_4 = "SELECT `pynames` FROM `users` WHERE `weiboid` =" . $v2;
$data_4 = $mysql->getData($sql_4);
if ($mysql->errno() != 0) {
die("Error_4:" . $mysql->errmsg());
}
if (count($data_4) == 0) {
echo '<p/>';
echo 'pynames: ' . $v2 . ' 还没有使用本服务<br/>';
} else {
echo 'pynames: ' . $v2 . ' 选中的有:';
foreach ($data_4 as $v3) {
//echo '<p/>';
echo $v3['pynames'] . '<br/>';
if (strpos($v3['pynames'], (string) $userid, 0) === false) {
//echo '没有找到';
} else {
echo '用户' . $v2 . '也选择了您!';
}
}
}
}
//SelectTag($ps);
}
}
$mysql->closeDb();
}
示例10: 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();
}
示例11: saveping
public function saveping($source, $destination, $min, $avg, $max, $loss)
{
$mysql = new SaeMysql();
$sql = "INSERT INTO `ping` (`source`, `destination`, `min`, `avg`, `max`, `loss`, `time`)" . " VALUES ('" . $mysql->escape($source) . "', '" . $mysql->escape($destination) . "', " . $min . ", " . $avg . ", " . $max . ", " . $loss . ", NOW())";
$mysql->runSql($sql);
if ($mysql->errno() != 0) {
log_message('error', "MySQL Error: " . $mysql->errmsg());
//die( "Error: " . $mysql->errmsg() );
die($sql);
}
$mysql->closeDb();
}
示例12: values
if ($row1 != false) {
//更新答案操作
$sql = "update `choice_answer` set `answer`='{$post_answer}' where `user_id`={$uid} and `ques_id`={$qid}";
$mysql->runSql($sql);
$str = "答案修改成功";
if ($user_answer == $right_answer && $post_answer != $right_answer) {
//原答案正确并且现答案错误,则执行减分操作
$sql = "update `qs_user` set `grade`=`grade`-{$score} where `id`={$uid}";
$mysql->runSql($sql);
} else {
if ($user_answer != $right_answer && $post_answer == $right_answer) {
//原答案错误并且现答案正确,执行加分操作
$sql = "update `qs_user` set `grade`=`grade`+{$score} where `id`={$uid}";
$mysql->runSql($sql);
}
}
} else {
//插入答案操作
$sql = "insert into `choice_answer` (`user_id`,`ques_id`,`answer`) values ({$uid},{$qid},'{$post_answer}') ";
$mysql->runSql($sql);
$str = "答案提交成功";
if ($post_answer == $right_answer && $mysql->errno() == 0) {
//提交答案正确,执行加分操作
$sql = "update `qs_user` set `grade`=`grade`+{$score} where `id`={$uid}";
$mysql->runSql($sql);
}
}
if ($mysql->errno() == 0) {
echo $str;
}
$mysql->closeDb();