本文整理汇总了PHP中sql::result方法的典型用法代码示例。如果您正苦于以下问题:PHP sql::result方法的具体用法?PHP sql::result怎么用?PHP sql::result使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql
的用法示例。
在下文中一共展示了sql::result方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sql
function __construct($id)
{
$sql = new sql();
$sql->result("SELECT * FROM " . sql::table('server') . " WHERE id = '" . $id . "'");
$this->sql = $sql;
$this->id = $this->sql->get('id');
}
示例2: loginPost
protected static function loginPost()
{
$email = type::post('email', 'string');
$password = type::post('password', 'string');
$remember = type::post('remember', 'int');
if (is_null($email) || is_null($password) || $email == '' || $password == '') {
echo message::info(lang::get('fill_out_both'));
return;
}
$sql = new sql();
$sql->query('SELECT password, salt, id FROM ' . sql::table('user') . ' WHERE `email` = "' . $sql->escape($email) . '"');
if (!$sql->num()) {
echo message::danger(sprintf(lang::get('email_not_found'), htmlspecialchars($email)), true);
$shake = 1;
return;
}
$sql->result();
if (!self::checkPassword($password, $sql->get('salt'), $sql->get('password'))) {
echo message::danger(lang::get('wrong_pw'));
$shake = 1;
return;
}
self::loginSession();
self::$userID = $sql->get('id');
$_SESSION['login'] = $sql->get('id');
if ($remember) {
setcookie("remember", $sql->get('id'), time() + 3600 * 24 * 7);
}
}
示例3: num
public function num($query = false)
{
if (!$query) {
return $this->query ? $this->query->num_rows : 0;
}
$sql = new sql();
$sql->result($query);
return $sql->num();
}
示例4: elseif
</a>
<button type="submit" name="sendNew"><?php
echo lang::get('add');
?>
</button>
</form>
</div>
</div>
<?php
} elseif ($action == 'edit' && $id) {
if (isset($_POST['send'])) {
$sqlUser = new sql();
$sqlUser->result("SELECT * FROM " . sql::table('user') . " WHERE id = '" . $sqlUser->escape($id) . "'");
$perms = json_decode(type::post('rights'));
$rights = [];
foreach ($perms as $key => $val) {
foreach ($val as $var) {
$rights[] = $key . '[' . $var . ']';
}
}
$sql = new sql();
$sql->setTable('user');
$sql->setWhere('id=' . $id);
$admin = isset($_POST['admin']) ? 1 : 0;
$sql->addPost('perms', implode('|', $rights));
$sql->addPost('firstname', type::post('firstname'));
$sql->addPost('name', type::post('name'));
$sql->addPost('email', type::post('email'));