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


PHP DbHandler::getRecords方法代码示例

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


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

示例1: array

        $response['status'] = "success";
        $response['message'] = "Hapus data berhasil!";
    } else {
        $response['status'] = "error";
        $response['message'] = "Maaf, hapus data tidak berhasil!";
    }
    $result["result"] = array($response['status'], $response['message']);
    echo json_encode($result);
});
/* END TINGKATAN */
/* BEGIN PENGGUNA */
$app->get('/pengguna', function () use($app) {
    $response = array();
    $db = new DbHandler();
    $query = "select a.*,@rownum:=@rownum+1 as num from (select u.iduser,u.user,u.nama_lengkap,ul.userlevel from user u inner join userlevel ul on u.iduserlevel=ul.iduserlevel) a, (select @rownum:=0) r order by a.iduser";
    $pengguna = $db->getRecords($query);
    $result["result"] = $pengguna;
    echo json_encode($result);
});
$app->get('/pengguna/:iduser', function ($iduser) use($app) {
    $db = new DbHandler();
    $query = "select * from user where iduser=" . $iduser;
    $pengguna = $db->getOneRecord($query);
    $result["result"] = array();
    if ($pengguna) {
        $result["result"] = array($pengguna);
    }
    echo json_encode($result);
});
$app->put('/pengguna/:iduser', function ($iduser) use($app) {
    $response = array();
开发者ID:advcha,项目名称:persuratan,代码行数:31,代码来源:authentication.php

示例2: DbHandler

        $app->stop();
    }
    $db = new DbHandler();
    $db->updateOneRecord("update users set teamname = '{$tn}' where name='{$tl}'");
    $response["status"] = "success";
    $response["message"] = "Moved '{$tl}' to '{$tn}'";
    echoResponse(200, $response);
});
$app->post('/getteammates', function () use($app) {
    $response = array();
    $r = json_decode($app->request->getBody());
    $role = $r->role;
    $uid = $r->uid;
    $db = new DbHandler();
    if ($role == "admin") {
        $result_teammates = $db->getRecords("select name,teamname from users where teamname != ''");
        $result_free_teammates = $db->getRecords("select name from users where teamname = ''");
        $result_tn = $db->getRecords("select teamname from users where teamname != ''");
        $result_roles = $db->getRecords("SELECT user_roles.name,user_roles.role,user_roles.teamname FROM user_roles LEFT JOIN users ON user_roles.uid = users.uid WHERE users.role = 'team_member'");
        $result_free_roles = $db->getRecords("SELECT users.name,users.teamname FROM users WHERE users.uid NOT IN (SELECT user_roles.uid FROM user_roles) AND users.role = 'team_member'");
        $response["teammates"] = $result_teammates;
        $response["free_teammates"] = $result_free_teammates;
        $response["tn"] = $result_tn;
        $response["roles"] = $result_roles;
        $response["free_roles"] = $result_free_roles;
        $response["status"] = "success";
        $response["message"] = "Users Found";
        echoResponse(200, $response);
    } else {
        $result_tn = $db->getOneRecord("select teamname from users where uid='{$uid}'");
        $teamname = $result_tn['teamname'];
开发者ID:allanjeng,项目名称:Project_FTSD,代码行数:31,代码来源:management.php


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