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


PHP DBLayer::executeReturnId方法代码示例

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


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

示例1: create

 /**
  * creates a new 'ticket' entry.
  * this method will use the object's attributes for creating a new 'ticket' entry in the database.
  */
 public function create()
 {
     $dbl = new DBLayer("lib");
     $this->tId = $dbl->executeReturnId("ticket", array('Title' => $this->title, 'Status' => $this->status, 'Queue' => $this->queue, 'Ticket_Category' => $this->ticket_category, 'Author' => $this->author, 'Priority' => $this->priority), array('Timestamp' => 'now()'));
 }
开发者ID:cls1991,项目名称:ryzomcore,代码行数:9,代码来源:ticket.php

示例2: DBLayer

//require the pages that are being needed.
require '../../config.php';
require '../../../ams_lib/libinclude.php';
ini_set("display_errors", true);
error_reporting(E_ALL);
//var used to access the DB;
global $cfg;
try {
    //SETUP THE WWW DB
    $dbs = new DBLayer("shard");
    $sql = "SELECT * FROM user";
    $statement = $dbs->executeWithoutParams($sql);
    $users = $statement->fetchAll();
    foreach ($users as $user) {
        //add user to web
        $dbw = new DBLayer("web");
        if (!$dbw->execute("SELECT * FROM ams_user WHERE Login = :name", array('name' => $user['Login']))->rowCount()) {
            $query = "INSERT INTO ams_user (Login, Password, Email, Language) VALUES (:name, :pass, :mail, :lang)";
            global $DEFAULT_LANGUAGE;
            $vars = array('name' => $user['Login'], 'pass' => $user['Password'], 'mail' => $user['Email'], 'lang' => $DEFAULT_LANGUAGE);
            $id = $dbw->executeReturnId($query, $vars);
            $dbl = new DBLayer("lib");
            $query = "INSERT INTO `ticket_user` (Permission, ExternId) VALUES (1, :id)";
            $vars = array('id' => $id);
            $dbl->execute($query, $vars);
        }
    }
    print "The users were imported! ";
} catch (PDOException $e) {
    print "There was an error while creating the admin account! ";
}
开发者ID:cls1991,项目名称:ryzomcore,代码行数:31,代码来源:importusers.php

示例3: create

 /**
  * creates a new 'tickt_content' entry.
  * this method will use the object's attributes for creating a new 'ticket_content' entry in the database.
  */
 public function create()
 {
     $dbl = new DBLayer("lib");
     $this->tContentId = $dbl->executeReturnId("ticket_content", array('Content' => $this->content));
 }
开发者ID:ryzom,项目名称:ryzomcore,代码行数:9,代码来源:ticket_content.php

示例4: createWebuser

 /**
  * creates a webuser.
  * it will set the language matching to the language cookie setting and add it to the www/CMS's DB.
  * @param $name the username
  * @param $pass the unhashed password
  * @param $mail the email address
  */
 public static function createWebuser($name, $pass, $mail)
 {
     //register account with the correct language (check if cookie is already set)!
     if (isset($_COOKIE['Language'])) {
         $lang = $_COOKIE['Language'];
     } else {
         global $DEFAULT_LANGUAGE;
         $lang = $DEFAULT_LANGUAGE;
     }
     $values = array('name' => $name, 'pass' => $pass, 'mail' => $mail, 'lang' => $lang);
     try {
         $dbw = new DBLayer("web");
         return $dbw->executeReturnId("INSERT INTO ams_user (Login, Password, Email, Language) VALUES (:name, :pass, :mail, :lang)", $values);
     } catch (PDOException $e) {
         //ERROR: the web DB is offline
     }
 }
开发者ID:ryzom,项目名称:ryzomcore,代码行数:24,代码来源:webusers.php

示例5: create

 /**
  * creates a new 'ticket_reply' entry.
  * this method will use the object's attributes for creating a new 'ticket_reply' entry in the database (the now() function will create the timestamp).
  */
 public function create()
 {
     $dbl = new DBLayer("lib");
     $this->tReplyId = $dbl->executeReturnId("ticket_reply", array('Ticket' => $this->ticket, 'Content' => $this->content, 'Author' => $this->author, 'Hidden' => $this->hidden), array('Timestamp' => 'now()'));
 }
开发者ID:ryzom,项目名称:ryzomcore,代码行数:9,代码来源:ticket_reply.php


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