예제 #1
0
 /**
  * 插入一条新的记录到表
  * @param $data Array 必须是键值(表的字段对应值)对应
  * @return int
  */
 public final function put($data)
 {
     if (empty($data) or !is_array($data)) {
         return false;
     }
     $this->db->insert($data, $this->table);
     return $this->db->lastInsertId();
 }
예제 #2
0
파일: Model.php 프로젝트: out001a/framework
 /**
  * 插入一条新的记录到表
  * @param $data Array 必须是键值(表的字段对应值)对应
  * @return int
  */
 public function put($data)
 {
     if (empty($data) or !is_array($data)) {
         return false;
     }
     if ($this->db->insert($data, $this->table)) {
         $lastInsertId = $this->db->lastInsertId();
         if ($lastInsertId == 0) {
             return true;
         } else {
             return $lastInsertId;
         }
     } else {
         return false;
     }
 }