本文整理汇总了PHP中Chat::setChatID方法的典型用法代码示例。如果您正苦于以下问题:PHP Chat::setChatID方法的具体用法?PHP Chat::setChatID怎么用?PHP Chat::setChatID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Chat
的用法示例。
在下文中一共展示了Chat::setChatID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getChatByID
public static function getChatByID($chatID)
{
include 'connect.php';
$sql = "SELECT * FROM chats WHERE id = {$chatID}";
//echo $sql;
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
mysql_close();
if ($row) {
$chat = new Chat();
$chat->setChatID($row['id']);
$chat->setUser1($row['user1']);
$chat->setUser2($row['user2']);
return $chat;
} else {
return false;
}
}
示例2: date
//$_SESSION['status'] = $usr->isAvailable;
$_SESSION['prevTime'] = date('Y-m-d H:i:s');
if (!$usrk) {
$usr->storeUser();
} else {
$usr->updateUser();
}
}
$usr->setUserID($_SESSION['userID']);
$usr->refreshUser();
//echo $usr->chatID();
if ($usr->isAvailable()) {
$friend = User::getAvailableUser($usr->userID());
if ($friend) {
$chat = new Chat();
$chat->setChatID(Chat::generateID());
$chat->setUser1($usr->userID());
$chat->setUser2($friend->userID());
$chat->setIsNewMessage(0);
$usr->setAvailability(false);
$friend->setAvailability(false);
$usr->setChatID($chat->chatID());
$friend->setChatID($chat->chatID());
$chat->storeChat();
$usr->updateUser();
$friend->updateUser();
$ret['chat'] = true;
} else {
$ret['chat'] = false;
}
} else {