当前位置: 首页>>代码示例>>PHP>>正文


PHP SaeMysql::getVar方法代码示例

本文整理汇总了PHP中SaeMysql::getVar方法的典型用法代码示例。如果您正苦于以下问题:PHP SaeMysql::getVar方法的具体用法?PHP SaeMysql::getVar怎么用?PHP SaeMysql::getVar使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SaeMysql的用法示例。


在下文中一共展示了SaeMysql::getVar方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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;
}
开发者ID:0902horn,项目名称:urlwatcher-sae,代码行数:48,代码来源:diff.php

示例2: countPrinters

 static function countPrinters()
 {
     $mysql = new SaeMysql();
     $sql = "SELECT count(*) FROM `wx_printers`";
     $data = $mysql->getVar($sql);
     return $data;
 }
开发者ID:AxellH,项目名称:wxprinter,代码行数:7,代码来源:sae_tool.php

示例3: getTaskImage

 static function getTaskImage($print_code)
 {
     $mysql = new SaeMysql();
     $sql = "SELECT `image_url` FROM `wx_images` WHERE `print_code` = '{$print_code}'";
     $data = $mysql->getVar($sql);
     $sql = "DELETE FROM `wx_images` WHERE `image_url` = '{$data}'";
     $mysql->runSql($sql);
     $mysql->closeDb();
     return $data;
 }
开发者ID:Black-Spider,项目名称:why-wechat-printer,代码行数:10,代码来源:sae_tool.php

示例4: VALUES

    //用户以前是否关注过
    $everFollowed = "select openid,name from wechat_user WHERE openid='{$event->FromUserName}'";
    $user = $mysql->getLine($everFollowed);
    //用户第一次关注
    if ($user === false) {
        $signup = "insert into wechat_user(openid,followTime) VALUES ('{$event->FromUserName}','" . date("Y/m/d-H:i:s") . "')";
        $mysql->runSql($signup);
        sae_log("用户第一次关注");
        $mysql->closeDb();
        return Message::make('news')->items($welcome);
    } else {
        //MySQL如何修改现有的一行数据?
        //更新关注时间、关注状态,获取用户姓名
        $update = "update wechat_user set followTime = '" . date("Y/m/d-H:i:s") . "',isFollow = 1 WHERE\n        openid='{$event->FromUserName}' ";
        $mysql->runSql($update);
        $name = $mysql->getVar("select name from wechat_user WHERE openid = '{$event->FromUserName}'");
        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}'";
开发者ID:devsnippet,项目名称:MyWechat,代码行数:31,代码来源:Wechat.php

示例5: intval

$action = $_GET["action"];
$action = string::un_script_code($action);
$action = string::un_html($action);
//是否删除
if ($action == "del") {
    //获取部门ID号传入
    $class_id = intval($_GET["class_id"]);
    //获取当前时间
    $nowtime = date("Y/m/d H:i:s", time());
    $mysql->runSql("update class set status=0,edittime='{$nowtime}' where class_id={$class_id}");
    echo "<script>alert('操作成功!');location='class_manager.php?page={$page}';</Script>";
    exit;
}
//列表数据获取、分页
//计算总数
$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");
}
开发者ID:Kingson4Wu,项目名称:Kingson4WeixinOnSae,代码行数:31,代码来源:class_manager.php

示例6: SaeMysql

<?php

session_start();
//查询数据库,openid是否已经存在
//用SAEMySQL的getdata方法,如果结果为空,会返回false,但没有错误
$openid = $_GET['openid'];
$_SESSION['openid'] = $openid;
$mysql = new SaeMysql();
$query = "SELECT openid,name FROM wechat_user WHERE openid='{$openid}'";
//根据openid取出考号,以降序排列,默认查询考号最大的一次
$examid = "select examid from cet WHERE openid='{$openid}' ORDER BY examid DESC";
//从数组取出两个变量
$query = $mysql->getLine($query);
$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 {
开发者ID:j178,项目名称:MyWechat,代码行数:31,代码来源:cet.php

示例7: intval

$action = $_GET["action"];
$action = string::un_script_code($action);
$action = string::un_html($action);
//是否删除
if ($action == "del") {
    //获取问题ID号传入
    $question_id = intval($_GET["question_id"]);
    //获取当前时间
    $nowtime = date("Y/m/d H:i:s", time());
    $mysql->runSql("update question set status=0 where question_id={$question_id}");
    echo "<script>alert('操作成功!');location='question_manager.php?page={$page}';</Script>";
    exit;
}
//列表数据获取、分页
//计算总数
$count = $mysql->getVar("select COUNT(*) from question_tb where status=1");
//如果数据表里有数据
if ($count) {
    //每页显示记录数
    $page_num = 10;
    //如果无页码参数则为第一页
    if ($page == 0) {
        $page = 1;
    }
    //计算开始的记录序号
    $from_record = ($page - 1) * $page_num;
    //获取符合条件的数据
    $class_list = $mysql->getData("select *\n                from question_tb  \n                order by question_id desc \n                limit {$from_record},{$page_num}");
    //分页函数
    $multi = multi($count, $page_num, $page, "question_manager.php");
}
开发者ID:QPG,项目名称:answer_system,代码行数:31,代码来源:question_manager.php

示例8: SaeMysql

        
		.H1{
			font-size:23px;/*设置文字字号为12px*/
            color:red;
		}
        

	</style>
</head>
    
    
<?php 
$mysql = new SaeMysql();
//团委
$sql = "select count(*) from `BasicInfo` where C_Department='11'";
$data11 = $mysql->getVar($sql);
$sql = "select count(*) from `BasicInfo` where C_Department='12'";
$data12 = $mysql->getVar($sql);
$sql = "select count(*) from `BasicInfo` where C_Department='13'";
$data13 = $mysql->getVar($sql);
//学生会
$sql = "select count(*) from `BasicInfo` where C_Department='21'";
$data21 = $mysql->getVar($sql);
$sql = "select count(*) from `BasicInfo` where C_Department='22'";
$data22 = $mysql->getVar($sql);
$sql = "select count(*) from `BasicInfo` where C_Department='23'";
$data23 = $mysql->getVar($sql);
$sql = "select count(*) from `BasicInfo` where C_Department='24'";
$data24 = $mysql->getVar($sql);
$sql = "select count(*) from `BasicInfo` where C_Department='25'";
$data25 = $mysql->getVar($sql);
开发者ID:Noah-Zhang,项目名称:cumtcszx,代码行数:30,代码来源:success.php


注:本文中的SaeMysql::getVar方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。