本文整理汇总了PHP中PH7\Framework\Mvc\Model\Engine\Db::prefix方法的典型用法代码示例。如果您正苦于以下问题:PHP Db::prefix方法的具体用法?PHP Db::prefix怎么用?PHP Db::prefix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PH7\Framework\Mvc\Model\Engine\Db
的用法示例。
在下文中一共展示了Db::prefix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: browse
/**
* Browse Subscribers.
*
* @param mixed (integer for profile ID or string for a keyword) $mLooking
* @param boolean $bCount Put 'true' for count the subscribers or 'false' for the result of subscribers.
* @param string $sOrderBy
* @param string $sSort
* @param integer $iOffset
* @param integer $iLimit
* @return mixed (integer for the number subscribers returned or string for the subscribers list returned)
*/
public function browse($mLooking, $bCount, $sOrderBy, $sSort, $iOffset, $iLimit)
{
$bCount = (bool) $bCount;
$iOffset = (int) $iOffset;
$iLimit = (int) $iLimit;
$sSqlLimit = !$bCount ? ' LIMIT :offset, :limit' : '';
$sSqlSelect = !$bCount ? '*' : 'COUNT(profileId) AS totalUsers';
$sSqlWhere = ctype_digit($mLooking) ? ' WHERE profileId = :looking' : ' WHERE name LIKE :looking OR email LIKE :looking OR ip LIKE :looking';
$sSqlOrder = SearchCoreModel::order($sOrderBy, $sSort);
$rStmt = Db::getInstance()->prepare('SELECT ' . $sSqlSelect . ' FROM' . Db::prefix('Subscribers') . $sSqlWhere . $sSqlOrder . $sSqlLimit);
ctype_digit($mLooking) ? $rStmt->bindValue(':looking', $mLooking, \PDO::PARAM_INT) : $rStmt->bindValue(':looking', '%' . $mLooking . '%', \PDO::PARAM_STR);
if (!$bCount) {
$rStmt->bindParam(':offset', $iOffset, \PDO::PARAM_INT);
$rStmt->bindParam(':limit', $iLimit, \PDO::PARAM_INT);
}
$rStmt->execute();
if (!$bCount) {
$mData = $rStmt->fetchAll(\PDO::FETCH_OBJ);
} else {
$oRow = $rStmt->fetch(\PDO::FETCH_OBJ);
$mData = (int) $oRow->totalUsers;
unset($oRow);
}
Db::free($rStmt);
return $mData;
}
示例2: insert
public function insert($sKey, $fLastIp)
{
$rStmt = Db::getInstance()->prepare('INSERT INTO' . Db::prefix('Likes') . 'SET keyId =:key ,votes=1 , lastVote = NOW(), lastIp =:lastIp');
$rStmt->bindValue(':key', $sKey, \PDO::PARAM_STR);
$rStmt->bindValue(':lastIp', $fLastIp, \PDO::PARAM_INT);
return $rStmt->execute();
}
示例3: setClick
/**
* Adding an Advertisement Click.
*
* @param integer $iAdsId
* @return void
*/
public static function setClick($iAdsId)
{
$rStmt = Db::getInstance()->prepare('UPDATE' . Db::prefix('Ads') . 'SET clicks = clicks+1 WHERE adsId = :id LIMIT 1');
$rStmt->bindValue(':id', $iAdsId, \PDO::PARAM_INT);
$rStmt->execute();
Db::free($rStmt);
}
示例4: getMetaMain
public static function getMetaMain($sLangId)
{
$oCache = (new Cache())->start(self::CACHE_GROUP, 'metaMain' . $sLangId, self::CACHE_TIME);
// @return value of meta tags the database
if (!($oData = $oCache->get())) {
$sSql = 'SELECT * FROM' . Engine\Db::prefix('MetaMain') . 'WHERE langId = :langId';
// Get meta data with the current language if it exists in the "MetaMain" table ...
$rStmt = Engine\Db::getInstance()->prepare($sSql);
$rStmt->bindParam(':langId', $sLangId, \PDO::PARAM_STR);
$rStmt->execute();
$oData = $rStmt->fetch(\PDO::FETCH_OBJ);
// If the current language doesn't exist in the "MetaMain" table, we create a new table for the new language with default value
if (empty($oData)) {
$aData = ['langId' => $sLangId, 'pageTitle' => 'Home', 'metaDescription' => 'The Dating Software for creating online dating service or online social community.', 'metaKeywords' => 'script,CMS,PHP,dating script,dating software,social networking software,social networking script,social network script,free,open source,match clone,friend finder clone,adult friend finder clone', 'slogan' => 'Free Online Dating Community Site with Chat Rooms', 'promoText' => 'You\'re on the best place for meeting new people nearby! Chat, Flirt, Socialize and have Fun!<br />Create any Dating Sites like that with the <a href="http://software.hizup.com">PHP Dating Script</a>. It is Professional, Free, Open Source, ...', 'metaRobots' => 'index, follow, all', 'metaAuthor' => 'Pierre-Henry Soria', 'metaCopyright' => 'Copyright Pierre-Henry Soria. All Rights Reserved.', 'metaRating' => 'general', 'metaDistribution' => 'global', 'metaCategory' => 'dating'];
Engine\Record::getInstance()->insert('MetaMain', $aData);
// Create the new meta data language
$oData = (object) $aData;
unset($aData);
}
Engine\Db::free($rStmt);
$oCache->put($oData);
}
unset($oCache);
return $oData;
}
示例5: get
/**
* Gets Viewed Profile.
*
* @param string $sGender Constant (self::ALL, self::COUPLE, self::MALE, self::FEMALE). Default: self::ALL
* @param boolean $bCount Put TRUE for count birthdays or FALSE for the result of birthdays. Default: TRUE
* @param string $sOrderBy Default: SearchCoreModel::LAST_ACTIVITY
* @param string $sSort Default: SearchCoreModel::DESC
* @param integer $iOffset Default: NULL
* @param integer $iLimit Default: NULL
* @return mixed (object | integer) object for the birthdays list returned or integer for the total number birthdays returned.
*/
public function get($sGender = self::ALL, $bCount = false, $sOrderBy = SearchCoreModel::LAST_ACTIVITY, $sSort = SearchCoreModel::DESC, $iOffset = null, $iLimit = null)
{
$bIsLimit = null !== $iOffset && null !== $iLimit;
$bIsSex = $sGender !== self::ALL;
$bCount = (bool) $bCount;
$iOffset = (int) $iOffset;
$iLimit = (int) $iLimit;
$sSqlLimit = !$bCount && $bIsLimit ? 'LIMIT :offset, :limit' : '';
$sSqlSelect = !$bCount ? '*' : 'COUNT(profileId) AS totalBirths';
$sSqlWhere = $bIsSex ? ' AND (sex = :sex) ' : '';
$sSqlOrder = SearchCoreModel::order($sOrderBy, $sSort);
$rStmt = Db::getInstance()->prepare('SELECT ' . $sSqlSelect . ' FROM' . Db::prefix('Members') . 'WHERE (username <> \'' . PH7_GHOST_USERNAME . '\') AND (groupId=\'2\') AND (birthDate LIKE :date)' . $sSqlWhere . $sSqlOrder . $sSqlLimit);
$rStmt->bindValue(':date', '%' . (new CDateTime())->get()->date('-m-d'), \PDO::PARAM_STR);
if ($bIsSex) {
$rStmt->bindValue(':sex', $sGender, \PDO::PARAM_STR);
}
if (!$bCount && $bIsLimit) {
$rStmt->bindParam(':offset', $iOffset, \PDO::PARAM_INT);
$rStmt->bindParam(':limit', $iLimit, \PDO::PARAM_INT);
}
$rStmt->execute();
if (!$bCount) {
$oRow = $rStmt->fetchAll(\PDO::FETCH_OBJ);
Db::free($rStmt);
return $oRow;
} else {
$oRow = $rStmt->fetch(\PDO::FETCH_OBJ);
Db::free($rStmt);
return (int) $oRow->totalBirths;
}
}
示例6: getMetaMain
public static function getMetaMain($sLangId)
{
$oCache = (new Cache())->start(self::CACHE_GROUP, 'metaMain' . $sLangId, self::CACHE_TIME);
// @return value of meta tags the database
if (!($oData = $oCache->get())) {
$sSql = 'SELECT * FROM' . Engine\Db::prefix('MetaMain') . 'WHERE langId = :langId';
// Get meta data with the current language if it exists in the "MetaMain" table ...
$rStmt = Engine\Db::getInstance()->prepare($sSql);
$rStmt->bindParam(':langId', $sLangId, \PDO::PARAM_STR);
$rStmt->execute();
$oData = $rStmt->fetch(\PDO::FETCH_OBJ);
// If the current language doesn't exist in the "MetaMain" table, we create a new table for the new language with default value
if (empty($oData)) {
$aData = ['langId' => $sLangId, 'pageTitle' => 'Home', 'metaDescription' => 'The Dating Software for creating online dating service or online social community.', 'metaKeywords' => 'script,CMS,PHP,dating script,dating software,social networking software,social networking script,social network script,free,open source,match clone,friend finder clone,adult friend finder clone', 'slogan' => 'pH7CMS is the leading Dating CMS specializes in online open source dating software!', 'metaRobots' => 'index, follow, all', 'metaAuthor' => 'Pierre-Henry Soria', 'metaCopyright' => 'Copyright Pierre-Henry Soria. All Rights Reserved.', 'metaRating' => 'general', 'metaDistribution' => 'global', 'metaCategory' => 'dating'];
Engine\Record::getInstance()->insert('MetaMain', $aData);
// Create the new meta data language
$oData = (object) $aData;
unset($aData);
}
Engine\Db::free($rStmt);
$oCache->put($oData);
}
unset($oCache);
return $oData;
}
示例7: totalReports
public function totalReports()
{
$rStmt = Db::getInstance()->prepare('SELECT COUNT(reportId) AS totalRpts FROM' . Db::prefix('Report'));
$rStmt->execute();
$oRow = $rStmt->fetch(\PDO::FETCH_OBJ);
Db::free($rStmt);
return (int) $oRow->totalRpts;
}
示例8: deleteRecipient
/**
* Delete a comment.
*
* @param integer $iRecipientId The Comment Recipient ID.
* @param string $sTable The Comment Table.
* @return boolean Returns TRUE on success, FALSE on failure.
*/
public static function deleteRecipient($iRecipientId, $sTable)
{
$sTable = CommentCore::checkTable($sTable);
$iRecipientId = (int) $iRecipientId;
$rStmt = Db::getInstance()->prepare('DELETE FROM' . Db::prefix('Comments' . $sTable) . 'WHERE recipient = :recipient');
$rStmt->bindValue(':recipient', $iRecipientId, \PDO::PARAM_INT);
return $rStmt->execute();
}
示例9: delete
/**
* Delete Affiliate.
*
* @param integer $iProfileId
* @param string $sUsername
* @return void
*/
public function delete($iProfileId, $sUsername)
{
$iProfileId = (int) $iProfileId;
$oDb = Db::getInstance();
$oDb->exec('DELETE FROM' . Db::prefix('AffiliatesInfo') . 'WHERE profileId = ' . $iProfileId . ' LIMIT 1');
$oDb->exec('DELETE FROM' . Db::prefix('Affiliates') . 'WHERE profileId = ' . $iProfileId . ' LIMIT 1');
unset($oDb);
}
示例10: totalNotes
public function totalNotes()
{
$rStmt = Db::getInstance()->prepare('SELECT COUNT(noteId) AS totalNotes FROM' . Db::prefix('Notes') . 'WHERE approved = \'0\'');
$rStmt->execute();
$oRow = $rStmt->fetch(\PDO::FETCH_OBJ);
Db::free($rStmt);
return (int) $oRow->totalNotes;
}
示例11: _is
/**
* Generic method to check if the field exists and with the check \PH7\Framework\Mvc\Model\Engine\Util\Various::checkModelTable() method.
*
* @access protected
* @param string $sColumn
* @param string $sValue
* @param string $sTable
* @param string $sType PDO PARAM TYPE (\PDO::PARAM_*). Default is \PDO::PARAM_STR
* @param string $sParam Optional WHERE parameter SQL.
* @return boolean Returns TRUE if it exists, FALSE otherwise.
*/
protected function _is($sColumn, $sValue, $sTable, $sType = null, $sParam = null)
{
Various::checkModelTable($sTable);
$sType = empty($sType) ? \PDO::PARAM_STR : $sType;
$rExists = Db::getInstance()->prepare('SELECT COUNT(' . $sColumn . ') FROM' . Db::prefix($sTable) . 'WHERE ' . $sColumn . ' = :column ' . $sParam . ' LIMIT 1');
$rExists->bindValue(':column', $sValue, $sType);
$rExists->execute();
return $rExists->fetchColumn() == 1;
}
示例12: updateScore
public function updateScore($fScore, $iId, $sTable)
{
$sTable = Various::checkTable($sTable);
$sWhere = Various::convertTableToId($sTable);
$rStmt = Db::getInstance()->prepare('UPDATE' . Db::prefix($sTable) . 'SET score = :score WHERE ' . $sWhere . ' = :id');
$rStmt->bindValue(':score', $fScore);
$rStmt->bindValue(':id', $iId);
return $rStmt->execute();
}
示例13: deletePhoto
public function deletePhoto($iProfileId, $iAlbumId, $iPictureId = null)
{
$sSqlPictureId = !empty($iPictureId) ? ' AND pictureId=:pictureId ' : '';
$rStmt = Db::getInstance()->prepare('DELETE FROM' . Db::prefix('Pictures') . 'WHERE profileId=:profileId AND albumId=:albumId' . $sSqlPictureId);
$rStmt->bindValue(':profileId', $iProfileId, \PDO::PARAM_INT);
$rStmt->bindValue(':albumId', $iAlbumId, \PDO::PARAM_INT);
!empty($iPictureId) ? $rStmt->bindValue(':pictureId', $iPictureId, \PDO::PARAM_INT) : '';
return $rStmt->execute();
}
示例14: setClick
/**
* Adding an Advertisement Click.
*
* @param integer $iAdsId
* @return void
*/
public static function setClick($iAdsId)
{
$rStmt = Db::getInstance()->prepare('INSERT INTO' . Db::prefix('AdsClicks') . 'SET adsId = :adsId, url = :url, ip = :ip, dateTime = :dateTime');
$rStmt->bindValue(':adsId', $iAdsId, \PDO::PARAM_INT);
$rStmt->bindValue(':ip', \PH7\Framework\Ip\Ip::get(), \PDO::PARAM_STR);
$rStmt->bindValue(':dateTime', (new \PH7\Framework\Date\CDateTime())->get()->dateTime('Y-m-d H:i:s'), \PDO::PARAM_STR);
$rStmt->execute();
Db::free($rStmt);
}
示例15: insert
/**
* Add a new message.
*
* @param string $sFrom Username
* @param string $sTo Username 2
* @param string $sMessage Message content
* @param string $sDate In date format: 0000-00-00 00:00:00
* @return boolean Returns TRUE on success or FALSE on failure
*/
public function insert($sFrom, $sTo, $sMessage, $sDate)
{
$rStmt = Db::getInstance()->prepare('INSERT INTO' . Db::prefix('Messenger') . '(fromUser, toUser, message, sent) VALUES (:from, :to, :message, :date)');
$rStmt->bindValue(':from', $sFrom, \PDO::PARAM_STR);
$rStmt->bindValue(':to', $sTo, \PDO::PARAM_STR);
$rStmt->bindValue(':message', $sMessage, \PDO::PARAM_STR);
$rStmt->bindValue(':date', $sDate, \PDO::PARAM_STR);
return $rStmt->execute();
}