本文整理汇总了PHP中Connection::getTimeNow方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::getTimeNow方法的具体用法?PHP Connection::getTimeNow怎么用?PHP Connection::getTimeNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection::getTimeNow方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public static function add($paymetID, $amount, $is_success, $pay_type, $veh_id)
{
$companyId = $_SESSION['user']['company'];
$userId = $_SESSION['user']['id'];
$db = new Connection();
$conn = $db->connect();
$paytime = $db->getTimeNow();
if ($pay_type == 2) {
$paid_amount = 0;
$act_date = $paytime;
} else {
$act_date = Payments::getVehicleActivationDateFromDB($veh_id);
$paid_amount = Payments::getPreviousPaymentForVehicle($veh_id, $companyId);
}
$total_amount = DEF_MEM_AMOUNT;
$paid_amount += $amount;
$paid_per = 100 - ($total_amount - $paid_amount) / $total_amount * 100;
$rest_amount = $total_amount - $paid_amount;
$sql = "INSERT INTO `payments`(`amount`, `company_id`, `user_id`, `timestamp`, `is_success`, `pay_type`, `rest_amount`, `paid_perc`, `paid_amount`, `vehicle_id`, `total_amount`, `veh_activation_date`, `paymentId`) VALUES ('{$amount}','{$companyId}','{$userId}','{$paytime}','{$is_success}','{$pay_type}','{$rest_amount}','{$paid_per}','{$paid_amount}', '{$veh_id}', '{$total_amount}', '{$act_date}', '{$paymetID}')";
if (mysqli_query($conn, $sql)) {
return true;
} else {
return mysqli_error($conn);
}
return false;
}
示例2: Connection
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
require_once '../../framework/Connection.php';
//if(!isset($_SESSION))
// opening db connection
$db = new Connection();
$conn = $db->connect();
//print_r($_POST);
//print_r($_POST);
$id = $_POST['id'];
$solution = $_POST['solution'];
$user = $_SESSION['user']['id'];
$state = "closed";
$fgDate = $db->getTimeNow();
//add user
$issue = "UPDATE issue SET `state` = '{$state}', `solution` = '{$solution} ', `closed_by` = '{$user}', `date_closed` = '{$fgDate}' WHERE id = '{$id}'";
//echo $issue;
if (mysqli_query($conn, $issue)) {
echo "Issue Resolved!!!";
echo "<br><br><a href='index.php'>BACK TO LIST</a>";
} else {
echo "<br>error";
}
示例3: deploy
function deploy()
{
$db = new Connection();
$conn = $db->connect();
$lattitude_list;
$longitude_list;
$last_last_update;
$this->isDeployed = 1;
$fgDate = $db->getTimeNow();
$sql = "UPDATE vehicle SET deployed = '1', date_deployed = '{$fgDate}' WHERE id = '{$this->id}'";
//print_r($sql);
if (mysqli_query($conn, $sql)) {
return true;
} else {
return false;
//print_r("Error updating record: " . mysqli_error($conn));
}
}
示例4: addTimelineEvent
public static function addTimelineEvent($type, $vehicle, $driver, $employee, $addedBy, $action)
{
// opening db connection
$db = new Connection();
$conn = $db->connect();
$today = date('Y-m-d');
$fgDate = $db->getTimeNow();
if ($vehicle != "") {
$mVehicle = new Vehicle($vehicle);
}
if ($driver != "") {
$mDriver = new Vehicle($driver);
}
if ($employee != "") {
$mEmployee = new Vehicle($employee);
}
$mAddedBy = new User($addedBy);
$companyId = $mAddedBy->getCompany();
$mCompany = new Company($companyId);
$adminId = $mCompany->getAdmin();
$sql = "INSERT INTO `timeline` (`type`, `vehicle`, `driver`, `employee`, `company`, `admin`, `added_by`, `action`, `date_added`) VALUES ('{$type}', '{$vehicle}', '{$driver}', '{$employee}', '{$companyId}', '{$adminId}', '{$addedBy}', '{$action}', '{$fgDate}')";
//echo $sql;
if (mysqli_query($conn, $sql)) {
return true;
} else {
return false;
}
}
示例5: setLocation
function setLocation($lattitude, $longitude)
{
//require_once '../framework/DBConnect.php';
// opening db connection
$db = new Connection();
$conn = $db->connect();
$lattitude_list;
$longitude_list;
$last_last_update;
/*
* Select values from vehicle table
*/
$sql = "SELECT * FROM location WHERE job_id = '{$this->id}'";
$result = $conn->query($sql);
echo "-------->" . $sql . "<br>";
if ($result->num_rows > 0) {
print_r($sql);
while ($row = $result->fetch_assoc()) {
$lattitude_list = floatval($_POST['lattitude']) . ";" . $row['lattitude_list'];
$longitude_list = floatval($_POST['longitude']) . ";" . $row['longitude_list'];
$last_last_update = $row['last_update'];
}
}
/*
* Finally update the vehicle table with latest values
*/
$fgDate = $db->getTimeNow();
$sql = "UPDATE location SET lattitude = '{$lattitude}', longitude = '{$longitude}', last_update = '{$fgDate}', lattitude_list = '{$lattitude_list}', longitude_list = '{$longitude_list}', last_last_update = '{$last_last_update}' WHERE job_id = '{$this->id}'";
print_r($sql);
if (mysqli_query($conn, $sql)) {
print_r("Record updated successfully");
} else {
print_r("Error updating record: " . mysqli_error($conn));
}
}
示例6: deploy
function deploy()
{
//require_once '../framework/DBConnect.php';
// opening db connection
$db = new Connection();
$conn = $db->connect();
$lattitude_list;
$longitude_list;
$last_last_update;
/*
* Finally update the retvehicle table with latest values
*/
$this->isDeployed = 1;
$fgDate = $db->getTimeNow();
$sql = "UPDATE retvehicle SET deployed = '1', date_deployed = '{$fgDate}' WHERE id = '{$this->id}'";
//print_r($sql);
if (mysqli_query($conn, $sql)) {
return true;
} else {
return false;
//print_r("Error updating record: " . mysqli_error($conn));
}
}
示例7: addBatteryNotification
public static function addBatteryNotification($type, $driver, $vehicle, $latitude, $longitude)
{
$db = new Connection();
$conn = $db->connect();
$today = date('Y-m-d');
$fgDate = $db->getTimeNow();
//$type = "power_battery_plugged";
$origin = "vehicle";
$priority = Notification::getPriority($type);
$mVehicle = new Vehicle($vehicle);
$companyId = $mVehicle->getCompany();
$adminId = $mVehicle->getAddedBy();
$sql = "INSERT INTO `notification` (priority, type, origin, driver, vehicle, latitude, longitude, company, admin, date_added) VALUES ('{$priority}', '{$type}', '{$origin}', '{$driver}', '{$vehicle}', '{$latitude}', '{$longitude}', '{$companyId}', '{$adminId}', '{$fgDate}')";
//echo $sql;
if (mysqli_query($conn, $sql)) {
return true;
} else {
return false;
}
}