本文整理汇总了PHP中Status::select方法的典型用法代码示例。如果您正苦于以下问题:PHP Status::select方法的具体用法?PHP Status::select怎么用?PHP Status::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Status
的用法示例。
在下文中一共展示了Status::select方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: select
public static function select($id)
{
$connection = Flight::dbMain();
try {
$sql = "SELECT * FROM company WHERE id = :id;";
$query = $connection->prepare($sql);
$query->bindParam(':id', $id, PDO::PARAM_INT);
$query->execute();
if ($query->rowCount() < 1) {
return null;
}
$row = $query->fetch(PDO::FETCH_ASSOC);
$company = new Company();
$company->Id = (int) $row['id'];
$company->Name = $row['company_name'];
$company->Desc = $row['company_desc'];
$company->DtCreated = $row['company_dt_created'];
$company->Status = Status::select($row['e_status_id']);
return $company;
} catch (PDOException $pdoException) {
throw $pdoException;
} catch (Exception $exception) {
throw $exception;
} finally {
$connection = null;
}
}
示例2: login
public static function login()
{
$connection = Flight::dbMain();
try {
$session = json_decode(file_get_contents("php://input"));
if ($session == null) {
throw new Exception(json_get_error());
}
$sql = "SELECT * FROM user WHERE user.user_name = :name and user.user_password = :password;";
$query = $connection->prepare($sql);
$password = hash('sha256', $session->Password);
$query->bindParam(':name', $session->Name, PDO::PARAM_STR);
$query->bindParam(':password', $password, PDO::PARAM_STR);
$query->execute();
$row = $query->fetch(PDO::FETCH_ASSOC);
if ($query->rowCount() < 1) {
throw new Exception("Username or Password is not exist");
}
$user = new User();
$user->Id = (int) $row['id'];
$user->Name = $row['user_name'];
$user->DtCreated = $row['user_dt_created'];
$user->DtExpired = $row['user_dt_expired'];
// $user->Privilege = (int) $row['e_privilege_id'];
// $user->Status = (int) $row['e_status_id'];
// $user->Company = (int) $row['company_id'];
// $user->Sim = $row['sim_id'] == null ? null : (int) $row['sim_id'];
$user->Privilege = Privilege::select($row['e_privilege_id']);
$user->Status = Status::select($row['e_status_id']);
$user->Company = Company::select($row['company_id']);
$user->Sim = Sim::select($row['sim_id']);
Flight::ok($user);
} catch (PDOException $pdoException) {
Flight::error($pdoException);
} catch (Exception $exception) {
Flight::error($exception);
} finally {
$connection = null;
}
}
示例3: getStatus
public function getStatus()
{
$status = Status::select('ruta', 'estado')->get();
return Response::json(array('status' => $status));
}
示例4: selectByCompany
public static function selectByCompany($id)
{
$connection = Flight::dbMain();
try {
$sql = "SELECT * FROM driver WHERE company_id = :company;";
$query = $connection->prepare($sql);
$query->bindParam(':company', $id, PDO::PARAM_INT);
$query->execute();
$rows = $query->fetchAll(PDO::FETCH_ASSOC);
$result = array();
foreach ($rows as $row) {
$driver = new Driver();
$driver->Id = (int) $row['id'];
$driver->DriverId = $row['driver_id'];
$driver->Name = $row['driver_name'];
$driver->NameFirst = $row['driver_name_f'];
$driver->NameMiddle = $row['driver_name_m'];
$driver->NameLast = $row['driver_name_l'];
$driver->Rfid = $row['driver_rfid'];
$driver->DtCreated = $row['driver_dt_created'];
$driver->Status = Status::select($row['e_status_id']);
$driver->Company = Company::select($row['company_id']);
array_push($result, $driver);
}
return $result;
} catch (PDOException $pdoException) {
throw $pdoException;
} catch (Exception $exception) {
throw $exception;
} finally {
$connection = null;
}
}
示例5: switch
<?php
if (isset($_GET['do']) && !empty($_GET['do'])) {
$action = $_GET['do'];
$result = [];
switch ($action) {
case 'getposts':
require '../class/status.php';
$status = new Status();
$u_id = $_GET['uid'];
$limit = $_GET['l'];
$id = $_GET['id'];
$posts = $status->select($limit, $id);
foreach ($posts as $post) {
$likes = $status->getLikes($post['id']);
if (isset($likes[0]['u_id']) && $likes[0]['u_id'] == 1) {
$post['liked'] = 1;
} else {
$post['liked'] = 0;
}
$post['likeCount'] = count($likes);
$result[] = $post;
}
break;
}
$result = json_encode($result);
echo $result;
} else {
echo 'Invalid request!';
}
示例6: findEditionByMagazine
public static function findEditionByMagazine($magazine = null)
{
return Status::select('edition')->where('magazine', '=', $magazine)->groupBy('edition')->get();
}
示例7: selectByCompany
public static function selectByCompany($id)
{
$connection = Flight::dbMain();
try {
$sql = "SELECT * FROM user WHERE company_id = :company;";
$query = $connection->prepare($sql);
$query->bindParam(':company', $id, PDO::PARAM_INT);
$query->execute();
$rows = $query->fetchAll(PDO::FETCH_ASSOC);
$result = array();
foreach ($rows as $row) {
$user = new User();
$user->Id = (int) $row['id'];
$user->Name = $row['user_name'];
$user->DtCreated = $row['user_dt_created'];
$user->DtExpired = $row['user_dt_expired'];
// $user->Privilege = (int) $row['e_privilege_id'];
// $user->Status = (int) $row['e_status_id'];
// $user->Company = (int) $row['company_id'];
// $user->Sim = $row['sim_id'] == null ? null : (int) $row['sim_id'];
$user->Privilege = Privilege::select($row['e_privilege_id']);
$user->Status = Status::select($row['e_status_id']);
$user->Company = Company::select($row['company_id']);
$user->Sim = Sim::select($row['sim_id']);
array_push($result, $user);
}
return $result;
} catch (PDOException $pdoException) {
throw $pdoException;
} catch (Exception $exception) {
throw $exception;
} finally {
$connection = null;
}
}
示例8: selectByCompany
public static function selectByCompany($id)
{
$connection = Flight::dbMain();
try {
$sql = "SELECT * FROM sim WHERE company_id = :company;";
$query = $connection->prepare($sql);
$query->bindParam(':company', $id, PDO::PARAM_INT);
$query->execute();
$rows = $query->fetchAll(PDO::FETCH_ASSOC);
$result = array();
foreach ($rows as $row) {
$sim = new Sim();
$sim->Id = (int) $row['id'];
$sim->Imei = $row['sim_imei'];
$sim->Number = $row['sim_number'];
$sim->Roaming = (bool) $row['sim_roaming'];
$sim->SimVendor = SimVendor::select($row['e_sim_vendor_id']);
$sim->DtCreated = $row['sim_dt_created'];
$sim->Status = Status::select($row['e_status_id']);
$sim->Company = Company::select($row['company_id']);
array_push($result, $sim);
}
return $result;
} catch (PDOException $pdoException) {
throw $pdoException;
} catch (Exception $exception) {
throw $exception;
} finally {
$connection = null;
}
}
示例9: function
}
});
//=============================================================================
//Status
//=============================================================================
Flight::route('GET /v1/main/status', function () {
try {
$array = Status::selectAll();
Flight::ok($array);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('GET /v1/main/status/@id', function ($id) {
try {
$object = Status::select($id);
Flight::ok($object);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('POST /v1/main/status', function () {
try {
$object = Status::insert();
Flight::ok($object);
} catch (Exception $exception) {
Flight::error($exception);
}
});
Flight::route('PUT /v1/main/status/@id', function ($id) {
try {
示例10: getUpdate
public function getUpdate()
{
$estados = Status::select('estado')->get();
return Response::json(array('estados' => $estados));
}
示例11: selectByCompany
public static function selectByCompany($id)
{
$connection = Flight::dbMain();
try {
$sql = "SELECT * FROM vehicle WHERE company_id = :company;";
$query = $connection->prepare($sql);
$query->bindParam(':company', $id, PDO::PARAM_INT);
$query->execute();
$rows = $query->fetchAll(PDO::FETCH_ASSOC);
$result = array();
foreach ($rows as $row) {
$vehicle = new Vehicle();
$vehicle->Id = (int) $row['id'];
$vehicle->DtCreated = $row['vehicle_dt_created'];
$vehicle->DtSubscribed = $row['vehicle_dt_subscribed'];
$vehicle->Plate = $row['vehicle_plate'];
$vehicle->Name = $row['vehicle_name'];
$vehicle->Model = $row['vehicle_model'];
$vehicle->MaInitial = (int) $row['vehicle_ma_initial'];
$vehicle->MaLimit = (int) $row['vehicle_ma_limit'];
$vehicle->MaMaintenance = (int) $row['vehicle_ma_maintenance'];
$vehicle->SpeedMax = (int) $row['vehicle_speed_max'];
$vehicle->FuelMax = (int) $row['vehicle_fuel_max'];
// $vehicle->Status = (int)$row['e_status_id'];
// $vehicle->Driver = $row['driver_id'] == null ? null : (int)$row['driver_id'];
// $vehicle->Unit = $row['unit_id'] == null ? null : (int)$row['unit_id'];
// $vehicle->Company = (int) $row['company_id'];
// $vehicle->TrackeeType = (int) $row['e_trackee_type_id'];
$vehicle->Status = (int) $row['e_status_id'];
$vehicle->Driver = Driver::select($row['driver_id']);
$vehicle->Unit = Unit::select($row['unit_id']);
$vehicle->Company = Company::select($row['company_id']);
$vehicle->TrackeeType = TrackeeType::select($row['e_trackee_type_id']);
$vehicle->Status = Status::select($row['e_status_id']);
array_push($result, $vehicle);
}
return $result;
} catch (PDOException $pdoException) {
throw $pdoException;
} catch (Exception $exception) {
throw $exception;
} finally {
$connection = null;
}
}