Re: Fwd: MDB2 - getAfterID raises "could not get last insert ID"
| From: | Lukas Smith | Date: | Mon, 26 Jun 2006 15:47:07 +0000 |
| Subject: | Re: Fwd: MDB2 - getAfterID raises "could not get last insert ID" | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-24467@lists.php.net to get a copy of this message | ||
LFaR wrote:
(Apologies - I incorrectly posted to pear-dev - I hope this list is correct, please direct me if not) Hello keen MDB2 fans, After using autoExecute to insert a new record into a table, I have not been able to extract the last ID that was inserted. What could I be doing wrong? Some of the details: $affected = $this->dao->db->extended->autoExecute(hmm not sure .. this works fine in my tests. btw: as you may notice from the error message: internally MDB2 uses lastInsertID() for RDBMS that support autoincrement. so you could also call for slightly better performance: $this->dao->db->lastInsertID(); I have heard unconfirmed reports about issues with autoincrement and MDB2 with mysqli. Not sure if there is some buggy version of MySQL on the loose. What version of MySQL are you running? If you are sure you are not doing something wrong, please file a bug report. Optionally this should include a script that I can run that causes the above mentioned issues on your system. regards, Lukas$this->table_name, $post, $autoquery, $where, null);This succeeds. Immediately after this I issue: echo '<pre>_iud Last ID: '; print_r($this->dao->db->extended->getAfterId(0, null, null)); echo '</pre>'; This raises the error: MDB2 Error: Array: lastInsertID: Could not get last insert ID[Native code: 0]