本文整理汇总了PHP中sql_datetime函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_datetime函数的具体用法?PHP sql_datetime怎么用?PHP sql_datetime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_datetime函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
public function write($id, $data)
{
$time = time() + $this->expire_time;
$q = 'REPLACE tblSessionData (session_id,session_data,expires) VALUES(?, ?, ?)';
Sql::pUpdate($q, 'sss', $id, $data, sql_datetime($time));
return true;
}
示例2: setStatus
public static function setStatus($user_id, $text)
{
$status = new PersonalStatus();
$status->owner = $user_id;
$status->text = $text;
$status->time_saved = sql_datetime(time());
return $status->store();
}
示例3: create
/**
* Creates a new visit entry
* @param $type
* @param $owner_id
* @param $ref_id
*/
public static function create($type, $owner_id, $ref_id)
{
$o = new Visit();
$o->type = $type;
$o->owner = $owner_id;
$o->ref = $ref_id;
$o->time = sql_datetime(time());
$o->store();
}
示例4: markHandled
/**
* Mark feedback item as handled
* @param $message_id optionally refer to a response message
*/
public static function markHandled($id, $message_id = 0)
{
$session = SessionHandler::getInstance();
$i = self::get($id);
$i->time_answered = sql_datetime(time());
$i->answered_by = $session->id;
$i->message = $message_id;
$i->store();
}
示例5: set
public static function set($owner, $type, $user_id)
{
$l = new Like();
$l->owner = $owner;
$l->type = $type;
$l->user = $user_id;
$l->time = sql_datetime(time());
$l->store();
}
示例6: send
/**
* Creates a new poke
* @param $to
*/
public static function send($to)
{
$session = SessionHandler::getInstance();
$o = new Poke();
$o->from = $session->id;
$o->to = $to;
$o->time = sql_datetime(time());
$o->store();
}
示例7: editHandler
function editHandler($p)
{
$session = SessionHandler::getInstance();
$o = FaqItem::get($p['id']);
$o->question = $p['q'];
$o->answer = $p['a'];
$o->creator = $session->id;
$o->time_created = sql_datetime(time());
$o->store();
js_redirect('a/faq');
}
示例8: send
/**
* @return message id
*/
public static function send($to, $msg, $type = PRIV_MSG)
{
$session = SessionHandler::getInstance();
$m = new Message();
$m->to = $to;
$m->from = $session->id;
$m->body = $msg;
$m->type = $type;
$m->time_sent = sql_datetime(time());
return $m->store();
}
示例9: add
public static function add($type, $reference = 0, $data = '')
{
$session = SessionHandler::getInstance();
$c = new ModerationObject();
$c->type = $type;
$c->owner = $session->id;
$c->time_created = sql_datetime(time());
$c->data = $data;
$c->reference = $reference;
$c->id = $c->store();
return $c->id;
}
示例10: ago
/**
* Converts a SQL timestamp to a text string representing how long ago this timestamp occured
*
* @param $sql_time SQL timestamp
* @return text string representing how long ago this timestamp occured
*/
function ago($sql_time, $past = 'ago', $future = 'in', $just_now = 'just now')
{
$old_time = ts(sql_datetime($sql_time));
$curr_time = time();
if ($curr_time == $old_time) {
return $just_now;
}
if ($curr_time >= $old_time) {
return elapsed_seconds($curr_time - $old_time, 0) . ' ' . $past;
}
return $future . ' ' . elapsed_seconds($old_time - $curr_time, 0);
}
示例11: update
public function update()
{
$db = Database::get_instance();
$time_updated = sql_datetime();
$query = $db->prepare("UPDATE aspect_groups SET group_name=?, update_date=? WHERE id=?");
$data = array($this->group_name, $time_updated, $this->id);
if ($query->execute($data)) {
return true;
} else {
return false;
}
}
示例12: createHandler
function createHandler($p)
{
$session = SessionHandler::getInstance();
$o = new BlogEntry();
$o->owner = $session->id;
$o->subject = trim($p['subject']);
$o->body = trim($p['body']);
$o->time_created = sql_datetime(time());
$o->time_published = sql_datetime(time());
$o->id = $o->store();
js_redirect('a/blogs/overview');
}
示例13: save
public function save()
{
$db = Database::get_instance();
$time_saved = sql_datetime();
$query = $db->prepare("INSERT INTO log (message, time) VALUES (?, ?)");
$data = array($this->message, $time_saved);
if ($query->execute($data)) {
return true;
} else {
return false;
}
}
示例14: update
public function update()
{
$db = Database::get_instance();
$time_updated = sql_datetime();
$query = $db->prepare("UPDATE subject_types SET type_name=?, type_description=?, aspect_group=?, update_date=?, parent_id=? WHERE id=?");
$data = array($this->type_name, $this->type_description, $this->aspect_group, $time_updated, $this->parent_id, $this->id);
if ($query->execute($data)) {
return true;
} else {
return false;
}
}
示例15: create
/**
* Helper function to create new comments
*/
public static function create($type, $owner, $msg, $private = false)
{
$session = SessionHandler::getInstance();
$c = new Comment();
$c->type = $type;
$c->owner = $owner;
$c->msg = $msg;
$c->private = $private;
$c->creator = $session->id;
$c->creator_ip = client_ip();
$c->time_created = sql_datetime(time());
return $c->store();
}