本文整理匯總了PHP中Options::userExists方法的典型用法代碼示例。如果您正苦於以下問題:PHP Options::userExists方法的具體用法?PHP Options::userExists怎麽用?PHP Options::userExists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Options
的用法示例。
在下文中一共展示了Options::userExists方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: userAdd
public static function userAdd($userId, $option, $value = '')
{
$db = Database::getDatabase();
if (Options::userExists($userId, $option)) {
$db->query('UPDATE
options_users
SET
`value`=:value:
WHERE
`key`=:key: and `user_id`=:user_id:', array('key' => $option, 'value' => $value, 'user_id' => $userId));
/*echo "Update option";*/
} else {
$db->query('INSERT INTO
options_users
(`user_id`, `key`, `value`)
VALUES
(:user_id:, :key:, :value:)', array('user_id' => $userId, 'key' => $option, 'value' => $value));
/*echo "Inserted new option";*/
}
return $db->affectedRows();
}
示例2: foreach
<th>Group</th>
<th>First Name</th>
<th>Surname</th>
<th>Birthdate</th>
</tr>
</thead>
<tbody>
<?php
foreach ($users as $id => $values) {
echo "<tr>" . nl();
echo "<td>" . $values['username'] . "</td>" . nl();
echo "<td><a class='btn' href='mailto:" . $values['email'] . "?subject=Hi There'>Send Email</i></a></td>" . nl();
echo "<td>" . $values['group'] . "</td>" . nl();
echo "<td>" . Options::userGet($id, 'firstName') . "</td>" . nl();
echo "<td>" . Options::userGet($id, 'surname') . "</td>" . nl();
$dob = Options::userExists($id, 'dateOfBirth') ? time2str(Options::userGet($id, 'dateOfBirth')) : '';
echo "<td>" . $dob . "</td>" . nl();
echo "</tr>" . nl();
}
}
?>
</tbody>
</table>
<?php
if (isset($pager)) {
echo $pager;
}
// Print Pager
} else {