[Solar-talk] lastInsertId() not working with MySql?

Rodrigo Moraes rodrigo.moraes at gmail.com
Mon Mar 19 11:34:00 PDT 2007


I have a problem with Solar_Sql_Adapter::lastInsertId() & MySql
(trunk). It always returns 0, and I think it's because of the call to
_connect().

    public function lastInsertId($name = null)
    {
        $this->_connect();
        return $this->_pdo->lastInsertId($name);
    }

I removed $this->_connect() and now it returns the correct last
inserted id. It's strange, because pdo should be available when
lastInsertId() is called... but if i leave _connect() there, it
returns 0. Any clue why this happens?

rodrigo


More information about the solar-talk mailing list