Exemplo n.º 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();
 }
Exemplo n.º 2
0
 /**
  * 插入一条新的记录到表
  * @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;
     }
 }