本文整理汇总了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"));
}