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

Rodrigo Moraes rodrigo.moraes at gmail.com
Mon Mar 19 11:45:33 PDT 2007


On 3/19/07, Rodrigo Moraes wrote:
> 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?

one addition - the use case is pretty ordinary:

    $sql = Solar::registry('sql');
    $sql->insert(sql_table('item'), $data);
    $item_id = $sql->lastInsertId();

rodrigo


More information about the solar-talk mailing list