diff options
Diffstat (limited to 'it_dbi.class')
-rw-r--r-- | it_dbi.class | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/it_dbi.class b/it_dbi.class index 3c414f0..45a321d 100644 --- a/it_dbi.class +++ b/it_dbi.class @@ -50,6 +50,7 @@ class it_dbi var $_link; # DB link identifier (private) var $_dbid; # string identifying db connection. used for _state_purgeshared from outside var $_affectedrows;# Affected rows (mysql_affected_rows() gets clobbered) + var $_insertid; # Last inserted id (mysqli_insert_id() gets clobbered) var $_writes; # Number of (non-omittable) writes to sql using this instance @@ -561,6 +562,7 @@ function query($query, $p = array()) } $this->_affectedrows = $this->_link->affected_rows; # get_warnings() clobbers this + $this->_insertid = mysqli_insert_id($this->_link); # get_warnings() clobbers this if (($warning = $this->_link->get_warnings())) { do { @@ -763,7 +765,7 @@ function insert($tags = array(), $command = "INSERT") if ($result = $this->query($query = "$command INTO {$this->_p['table']} " . $set)) { - $id = ($this->_p['autoincrement'] && !isset($tags[$this->_p['keyfield']])) ? mysqli_insert_id($this->_link) : $tags[$this->_p['keyfield']]; + $id = ($this->_p['autoincrement'] && !isset($tags[$this->_p['keyfield']])) ? $this->_insertid : $tags[$this->_p['keyfield']]; if ($this->_p['keyfield'] && !$this->read($id) && $this->_p['safety']) $this->_fatal("insert(): can't read record back (key truncated?), id=\"$id\"", $query); |