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


PHP Sql::pInsert方法代码示例

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


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

示例1: addToGroup

 /** Adds the user to a user group */
 public static function addToGroup($user_id, $grp_id)
 {
     $q = 'SELECT COUNT(*) FROM ' . self::$tbl_name . ' WHERE groupId = ? AND userId = ?';
     if (Sql::pSelectItem($q, 'ii', $grp_id, $user_id)) {
         return true;
     }
     $q = 'INSERT INTO ' . self::$tbl_name . ' SET groupId = ?, userId = ?';
     Sql::pInsert($q, 'ii', $grp_id, $user_id);
     return true;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:11,代码来源:UserGroupHandler.php

示例2: store

 public function store()
 {
     $q = 'SELECT id FROM ' . self::$tbl_name . ' WHERE owner = ? AND season = ? AND episode = ?';
     $this->id = Sql::pSelectItem($q, 'iii', $this->owner, $this->season, $this->episode);
     if ($this->id) {
         $q = 'UPDATE ' . self::$tbl_name . ' SET owner = ?, title = ?, date = ?, info = ?, season = ?, episode = ?, link = ? WHERE id = ?';
         Sql::pUpdate($q, 'isssiisi', $this->owner, $this->title, $this->date, $this->info, $this->season, $this->episode, $this->link, $this->id);
         return $this->id;
     }
     $q = 'INSERT INTO ' . self::$tbl_name . ' SET owner = ?, title = ?, date = ?, info = ?, season = ?, episode = ?, link = ?';
     return Sql::pInsert($q, 'isssiis', $this->owner, $this->title, $this->date, $this->info, $this->season, $this->episode, $this->link);
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:12,代码来源:TvEpisode.php

示例3: set

 public static function set($type, $owner, $name, $val)
 {
     $q = 'SELECT id FROM ' . self::$tbl_name . ' WHERE owner = ? AND type = ? AND name = ?';
     if (Sql::pSelectItem($q, 'iis', $owner, $type, $name)) {
         $q = 'UPDATE ' . self::$tbl_name . ' SET time_saved = NOW(), value = ?' . ' WHERE owner = ? AND type = ? AND name = ?';
         Sql::pUpdate($q, 'siis', $val, $owner, $type, $name);
     } else {
         $q = 'INSERT INTO ' . self::$tbl_name . ' SET time_saved = NOW(),' . 'owner = ?, type = ?, name = ?, value = ?';
         Sql::pInsert($q, 'iiss', $owner, $type, $name, $val);
     }
     return true;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:12,代码来源:Setting.php

示例4: addVote

 /** Votes for a poll */
 static function addVote($type, $id, $value)
 {
     $session = SessionHandler::getInstance();
     if (!$session->id) {
         return false;
     }
     if (self::hasAnswered($type, $id)) {
         return false;
     }
     $q = 'INSERT INTO ' . self::$tbl_name . ' SET type = ?, owner = ?, userId = ?, value = ?, timestamp = NOW()';
     Sql::pInsert($q, 'iiii', $type, $id, $session->id, $value);
     return true;
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:14,代码来源:Rating.php

示例5: add

 public static function add($user_id, $ip, $user_agent, $type = LOGIN_INTERNAL)
 {
     $q = 'INSERT INTO ' . self::$tbl_name . ' SET timeCreated = NOW(), userId = ?, IP = ?, userAgent = ?, type = ?';
     return Sql::pInsert($q, 'issi', $user_id, $ip, $user_agent, $type);
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:5,代码来源:LoginEntry.php

示例6: create

 static function create($name, $level)
 {
     $session = SessionHandler::getInstance();
     $creator_id = $session->id ? $session->id : 0;
     $q = 'INSERT INTO tblUserGroups SET createdBy = ?, timeCreated = NOW(), name = ?, level = ?';
     return Sql::pInsert($q, 'isi', $creator_id, $name, $level);
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:7,代码来源:UserGroup.php

示例7: create

 /**
  * Creates a object in a database table
  * @return insert id
  */
 public static function create($obj, $tblname)
 {
     if (!is_alphanumeric($tblname)) {
         throw new \Exception('very bad');
     }
     $reflect = self::reflectQuery($obj, '', false);
     if (!$reflect->cols) {
         throw new \Exception('no columns defined for ' . $tblname);
     }
     $q = 'INSERT INTO ' . $tblname . ' SET ' . implode(', ', $reflect->cols);
     return Sql::pInsert($q, $reflect->str, $reflect->vals);
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:16,代码来源:SqlObject.php

示例8: addPollExactPeriod

 static function addPollExactPeriod($type, $owner, $text, $time_start, $time_end)
 {
     $session = SessionHandler::getInstance();
     $q = 'INSERT INTO tblPolls SET type = ?, owner = ?,' . ' created_by = ?, text = ?, time_start = ?,' . ' time_end = ?, time_created = NOW()';
     return Sql::pInsert($q, 'iiisss', $type, $owner, $session->id, trim($text), sql_datetime($time_start), sql_datetime($time_end));
 }
开发者ID:martinlindhe,项目名称:core_dev,代码行数:6,代码来源:PollItem.php


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