本文整理匯總了PHP中DBConnect::DoesRecordExist方法的典型用法代碼示例。如果您正苦於以下問題:PHP DBConnect::DoesRecordExist方法的具體用法?PHP DBConnect::DoesRecordExist怎麽用?PHP DBConnect::DoesRecordExist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DBConnect
的用法示例。
在下文中一共展示了DBConnect::DoesRecordExist方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: InvalidValueException
/**
*
* @param DBConnect $db
* @param <int> $userID
* @param <int> $childOf
* @param <string> $title
* @param <int> $rank
* @param <string> $content
* @param <int> $forumType
* @return <int> new pageID
*/
public static final function _CreatePage(
DBConnect &$db,
$userID,
$childOf,
$title,
$rank,
$content,
$isPrivate,
$forumType){
logger_FuncCall(__FILE__, __LINE__, __FUNCTION__);
if (!is_numeric($userID)){ throw new InvalidParamException(1, _T::NUMBER); }
if (!is_numeric($childOf)){ throw new InvalidParamException(2, _T::NUMBER); }
if (!is_string($title)){ throw new InvalidParamException(3, _T::STRING); }
if (!is_numeric($rank)){ throw new InvalidParamException(4, _T::NUMBER); }
if (!is_string($content)){ throw new InvalidParamException(5, _T::STRING); }
if (!is_bool($isPrivate)){ throw new InvalidParamException(6, _T::BOOL); }
if (!is_numeric($forumType)){ throw new InvalidParamException(7, _T::NUMBER); }
if (!$db->DoesRecordExist(USERS, USERS_USERID."=$userID") ||
$db->DoesRecordExist(USERS, USERS_USERNAME."='Guest' AND ".USERS_USERID."=$userID")){
throw new InvalidValueException('$userID');
}
if (!_FCORE::ValidateNumeric($forumType, 0, 2)){ throw new InvalidValueException('$forumType'); }
if (!$childOf!=0 && $db->DoesRecordExist(PAGES, PAGES_PAGEID."=$childOf AND ".PAGES_USERID."=$userID"))
{ throw new InvalidValueException('$childOf'); }
$title = $db->escapeString($title);
$content = $db->escapeString($content);
return $db->InsertThenReturnID(PAGES,
PAGES_USERID."=$userID,".
PAGES_CHILDOF."=$childOf,".
PAGES_TITLE."='$title',".
PAGES_RANK."=$rank,".
PAGES_CONTENT."='$content',".
PAGES_FORUMTYPE."=$forumType,".
PAGES_ISPRIVATE."=".($isPrivate ? "1" : "0"));
}