Joomla Array - 数据库

时间:2015-07-29 12:49:05

标签: php arrays joomla

如何设置一个数组,使其不是最大值 - 显示一个数字为30的倍数

即$ max = 30,60,90,120,150 ......等等

如果数组$ max匹配30,60,90,120,150,180,210 .....的倍数,那么它应显示限制耗尽的消息。

// Define the maximum Submissions
$max = 30;

// Get the current logged in user.
$user = JFactory::getUser();

// Get a database connection.
$db   = JFactory::getDbo();
$query   = $db->getQuery(true);

// Setup the query.
$query->select('COUNT('.$db->qn('Username').')')
    ->from($db->qn('#__rsform_submissions'))
    ->where($db->qn('Username').'='.$db->q($user->get('username')));

$db->setQuery($query);
$counter = $db->loadResult();

if ($counter = $max){
  $formLayout = '<p style="color:blue;">Your Limits are Exhausted </p>';
}

0 个答案:

没有答案