本文整理汇总了PHP中BaseModel::queryWithParametersLimit1方法的典型用法代码示例。如果您正苦于以下问题:PHP BaseModel::queryWithParametersLimit1方法的具体用法?PHP BaseModel::queryWithParametersLimit1怎么用?PHP BaseModel::queryWithParametersLimit1使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BaseModel
的用法示例。
在下文中一共展示了BaseModel::queryWithParametersLimit1方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
public function save()
{
$parameters = array('name' => $this->name, 'password' => $this->password, 'admin' => $this->admin);
$query = 'INSERT INTO Forum_User (name, password, admin) VALUES (:name, :password, :admin) RETURNING id';
$row = parent::queryWithParametersLimit1($query, $parameters);
$this->id = $row['id'];
}
示例2: save
public function save()
{
$parameters = array('title' => $this->title, 'forum_group_id' => $this->forum_group_id, 'creator' => $this->creator);
$query = 'INSERT INTO Topic (title, forum_group_id, creator) VALUES (:title, :forum_group_id, :creator) RETURNING id';
$row = parent::queryWithParametersLimit1($query, $parameters);
$this->id = $row['id'];
}
示例3: save
public function save()
{
$parameters = array('author' => $this->author, 'message' => $this->message, 'topic_id' => $this->topic_id);
$query = 'INSERT INTO Forum_Message (author, posted, message, topic_id) VALUES (:author, NOW(), :message, :topic_id) RETURNING id';
$row = parent::queryWithParametersLimit1($query, $parameters);
$this->id = $row['id'];
}
示例4: checkForDuplicate
public function checkForDuplicate()
{
$errors = array();
$parameters = array('user_id' => $this->user_id, 'forum_group_id' => $this->forum_group_id);
$query = 'SELECT * FROM Group_Member WHERE user_id = :user_id AND forum_group_id = :forum_group_id LIMIT 1';
$row = parent::queryWithParametersLimit1($query, $parameters);
if ($row) {
$errors[] = "Käyttäjä on jo ryhmän jäsen";
}
return $errors;
}
示例5: findByID
public static function findByID($id)
{
$row = parent::queryWithParametersLimit1('SELECT * FROM Forum_Group WHERE id = :id LIMIT 1', array('id' => $id));
return new Group(array('id' => $row['id'], 'name' => $row['name'], 'creator' => $row['creator']));
}