本文整理汇总了PHP中task::addBid方法的典型用法代码示例。如果您正苦于以下问题:PHP task::addBid方法的具体用法?PHP task::addBid怎么用?PHP task::addBid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类task
的用法示例。
在下文中一共展示了task::addBid方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: task
<?php
require_once 'task_class.php';
if (isset($_POST['taskid'])) {
$task = new task();
$task->getFromDB($_POST['taskid']);
} else {
$error['invalidtaskid'] = true;
echo json_encode($error);
return;
}
if (isset($_POST['bidderid']) && isset($_POST['bidamt'])) {
$error = $task->addBid($_POST['bidderid'], $_POST['bidamt']);
if ($error == null) {
$error['Success'] = true;
}
echo json_encode($error);
} else {
$error['invalidbidderidorbidamt'] = true;
echo json_encode($error);
}
示例2: task
$task = new task();
$error = $task->getFromDB($intaskid);
if (count($error) == 0) {
require_once 'php/user_class.php';
$user = new user();
$user->getFromDB($task->userid);
$date = new DateTime();
$date->setTimestamp($task->enddatetime);
$dateStr = $date->format('m/d/Y g:i A');
} else {
$_SESSION['msg_badtaskid'] = "Bad task id";
}
if (isset($_POST['submit'])) {
$biderror = array();
if (isset($_SESSION['userid'])) {
$biderror = $task->addBid($_SESSION['userid'], $_POST['Bid']);
} else {
$_SESSION['msg_needlogin'] = "Log in to bid";
}
if (count($biderror) == 0) {
$_SESSION['msg_bidplaced'] = "Bid Placed";
}
if (isset($biderror['active'])) {
$_SESSION['msg_bidover'] = "Bidding Ended";
}
if (isset($biderror['bidamount'])) {
$_SESSION['msg_bidless'] = "Must Bid Less Than Current";
}
if (isset($biderror['bidnegative'])) {
$_SESSION['msg_bidnegative'] = "Bid Cannot Be Negative";
}