当前位置: 首页>>代码示例>>PHP>>正文


PHP Database::lastInsertId方法代码示例

本文整理汇总了PHP中core\Database::lastInsertId方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::lastInsertId方法的具体用法?PHP Database::lastInsertId怎么用?PHP Database::lastInsertId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在core\Database的用法示例。


在下文中一共展示了Database::lastInsertId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public function update()
 {
     $inTransaction = Database::inTransaction();
     if (!$inTransaction) {
         Database::beginTransaction();
     }
     $statement = Database::prepare("UPDATE user_power SET `uid`=:uid WHERE id=:id");
     $statement->bindValue(':uid', $this->uid, \PDO::PARAM_INT);
     $statement->bindValue(':id', $this->id, \PDO::PARAM_INT);
     $statement->execute();
     $this->uid = Database::lastInsertId();
     $statement->execute();
     if (!$inTransaction) {
         Database::commit();
     }
 }
开发者ID:haitao-wang,项目名称:shadowsocks-panel,代码行数:16,代码来源:UserPower.php

示例2: insertToDB

 /**
  * Insert current user into database
  * @return int Auto-generated UserID for this user
  */
 public function insertToDB()
 {
     $inTransaction = Database::inTransaction();
     if (!$inTransaction) {
         Database::beginTransaction();
     }
     $statement = Database::prepare("INSERT INTO member SET email=:email, `password`=:pwd, nickname=:nickname");
     $statement->bindValue(':email', $this->email, \PDO::PARAM_STR);
     $statement->bindValue(':pwd', $this->password, \PDO::PARAM_STR);
     $statement->bindValue(':nickname', $this->nickname, \PDO::PARAM_STR);
     $statement->execute();
     $this->id = Database::lastInsertId();
     if (!$inTransaction) {
         Database::commit();
     }
     return $this->id;
 }
开发者ID:biaoiaoo,项目名称:KK-Framework,代码行数:21,代码来源:User.php

示例3: insertToDB

 /**
  * Insert current user into database
  * @return int Auto-generated UserID for this user
  */
 public function insertToDB()
 {
     $inTransaction = Database::inTransaction();
     if (!$inTransaction) {
         Database::beginTransaction();
     }
     $statement = Database::prepare("INSERT INTO member SET email=:email, `password`=:pwd, sspwd=:sspwd, `port`=:port, nickname=:nickname,\n            `flow_up`=:flow_up, `flow_down`=:flow_down, transfer=:transfer, plan=:plan, `enable`=:enable, invite=:invite, regDateLine=:regDateLine");
     $statement->bindValue(':email', $this->email, \PDO::PARAM_STR);
     $statement->bindValue(':pwd', $this->password, \PDO::PARAM_STR);
     $statement->bindValue(':sspwd', $this->sspwd, \PDO::PARAM_STR);
     $statement->bindValue(':port', $this->port, \PDO::PARAM_INT);
     $statement->bindValue(':nickname', $this->nickname, \PDO::PARAM_STR);
     $statement->bindValue(':flow_up', $this->flow_up, \PDO::PARAM_INT);
     $statement->bindValue(':flow_down', $this->flow_down, \PDO::PARAM_INT);
     $statement->bindValue(':transfer', $this->transfer, \PDO::PARAM_INT);
     $statement->bindValue(':plan', $this->plan, \PDO::PARAM_STR);
     $statement->bindValue(':enable', $this->enable, \PDO::PARAM_INT);
     $statement->bindValue(':invite', $this->invite, \PDO::PARAM_INT);
     $statement->bindValue(':regDateLine', $this->regDateLine, \PDO::PARAM_INT);
     $statement->execute();
     $this->uid = Database::lastInsertId();
     if (!$inTransaction) {
         Database::commit();
     }
     return $this->uid;
 }
开发者ID:gclove,项目名称:shadowsocks-panel,代码行数:30,代码来源:User.php

示例4: insertToDB

 /**
  * 增加 Node
  * @param node Id
  */
 public function insertToDB()
 {
     $statement = null;
     $inTransaction = Database::inTransaction();
     if (!$inTransaction) {
         Database::beginTransaction();
     }
     $statement = Database::prepare("INSERT INTO node SET `name`=:name, `type`=:type,\n\t\t\t`server`=:server, `method`=:method, `info`=:info, `status`:=status, `order`=:order");
     $statement->bindValue(':name', $this->name, \PDO::PARAM_STR);
     $statement->bindValue(':type', $this->type, \PDO::PARAM_INT);
     $statement->bindValue(':server', $this->server, \PDO::PARAM_STR);
     $statement->bindValue(':method', $this->method, \PDO::PARAM_STR);
     $statement->bindValue(':info', $this->info, \PDO::PARAM_STR);
     $statement->bindValue(':status', $this->status, \PDO::PARAM_STR);
     $statement->bindValue(':order', $this->order, \PDO::PARAM_INT);
     $statement->execute();
     $this->id = Database::lastInsertId();
     if (!$inTransaction) {
         Database::commit();
     }
     return $this->id;
 }
开发者ID:haitao-wang,项目名称:shadowsocks-panel,代码行数:26,代码来源:Node.php

示例5: insertToDB

 /**
  * Add message
  * @return string
  */
 public function insertToDB()
 {
     $statement = null;
     $inTransaction = Database::inTransaction();
     if (!$inTransaction) {
         Database::beginTransaction();
     }
     $statement = Database::prepare("INSERT INTO message SET `content`=:content, `pushTime`=:pushTime,\n\t\t\t`addTime`=:addTime, `pushUsers`=:pushUsers, `type`=:type, `pushEndTime`=:pushEndTime, `order`=:order");
     $statement->bindValue(':content', $this->content, \PDO::PARAM_STR);
     $statement->bindValue(':pushTime', $this->pushTime, \PDO::PARAM_INT);
     $statement->bindValue(':addTime', $this->addTime, \PDO::PARAM_INT);
     $statement->bindValue(':pushUsers', $this->pushUsers, \PDO::PARAM_STR);
     $statement->bindValue(':type', $this->type, \PDO::PARAM_INT);
     $statement->bindValue(':pushEndTime', $this->pushEndTime, \PDO::PARAM_INT);
     $statement->bindValue(':order', $this->order, \PDO::PARAM_INT);
     $statement->execute();
     $this->id = Database::lastInsertId();
     if (!$inTransaction) {
         Database::commit();
     }
     return $this->id;
 }
开发者ID:gclove,项目名称:shadowsocks-panel,代码行数:26,代码来源:Message.php


注:本文中的core\Database::lastInsertId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。