/** * * @param array $data * @return integer 最后插入的主键id */ public function insert($data) { $data = $this->mysql_escape_data($data); $data_values = $this->parse_data($data); $sql = 'INSERT INTO ' . $this->_table . ' SET ' . $data_values; $dbh = $this->_db->prepare($sql); $dbh->execute(); return $this->_db->lastInsertId(); }
/** * 插入最后插入的记录ID */ public function lastInsertId() { return $this->connectionWrite->lastInsertId(); }
/** * 返回当前新增ID * * @return number */ public function getId($sql = null) { return $this->_linkID->lastInsertId(); }