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


PHP DbHandler::getJourney方法代码示例

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


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

示例1: echoRespnse

        array_push($response["journey"], $tmp);
    }
    echoRespnse(200, $response);
});
/**
 * Listing single journey of particular user
 * method GET
 * url /journey/:id
 * Will return 404 if the journey doesn't belongs to user
 */
$app->get('/journey/:id', 'authenticate', function ($journey_id) {
    global $user_id;
    $response = array();
    $db = new DbHandler();
    // fetch journey
    $result = $db->getJourney($journey_id, $user_id);
    if ($result != NULL) {
        $response["error"] = false;
        $response["id"] = $result["id"];
        $response["journey_score"] = rand(1, 100);
        //$result["journey_score"];	// generating random score since analysis doesnt work
        $response["status"] = $result["status"];
        $response["createdAt"] = $result["created_at"];
        echoRespnse(200, $response);
    } else {
        $response["error"] = true;
        $response["message"] = "The requested resource doesn't exists";
        echoRespnse(404, $response);
    }
});
/**
开发者ID:blahblahQ,项目名称:Keep-on-Track-github,代码行数:31,代码来源:index.php

示例2: updateJourneyData

 /**
  * Updating Journey data table
  * @param String $journey_id id of the journey
  * @param String $user_id id of the user
  * @param String $x_gps gps x coordinate
  * @param String $y_gps gps y coordinate
  * @param String $z_gps gps z coordinate
  * @param String $x_acl accelerometer x coordinate
  * @param String $y_acl accelerometer y coordinate
  * @param String $z_acl accelerometer z coordinate
  * @param String $timestamp time when data was sampled
  * @param String $sample_no the sample number of the journey
  * 
  * jd - journey data table
  * j - journeys table
  * uj - user journeys table
  */
 public function updateJourneyData($journey_id, $user_id, $x_gps, $y_gps, $x_acl, $y_acl, $z_acl, $timestamp, $sample_no)
 {
     $db = new DbHandler();
     $result = $db->getJourney($journey_id, $user_id);
     if ($result == NULL) {
         //journey doesnt belong to user or doesnt exist
         return 0;
     } else {
         if ($result["status"] == 1) {
             // cant add data information to a completed journey
             return 0;
         }
     }
     // At last we can add the journey data!
     $stmt = $this->conn->prepare("INSERT INTO journey_data(journey_id, x_gps, y_gps, x_acl, y_acl, z_acl, time_stamp, sample_no) VALUES(?, ?, ?, ?, ?, ?, ?, ?)");
     $stmt->bind_param("idddddsi", $journey_id, $x_gps, $y_gps, $x_acl, $y_acl, $z_acl, $timestamp, $sample_no);
     $stmt->execute();
     $num_affected_rows = $stmt->affected_rows;
     $stmt->close();
     return $num_affected_rows > 0;
 }
开发者ID:blahblahQ,项目名称:Keep-on-Track-github,代码行数:38,代码来源:DbHandler.php


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