Can anybody test this issue in his machine? Thanks
The table definition: idmessage int (primary key, autoincrement (serial in PostgreSQL)) iduser int message varchar(255) I'm testing now in PostgreSQL and it works fine, maybe is something related to MySQL? On Thu, Jun 19, 2008 at 5:43 AM, Xavier Vidal Piera <[EMAIL PROTECTED]<http://www.nabble.com/user/SendEmail.jtp?type=post&post=18010441&i=2>> wrote: > Hi > > When i do a manual insert i can get the last insert id: > > /* Primary key: "idmessage", with auto_increment */ > $sql = "INSERT INTO messages (iduser, message) VALUES (?, ?)"; > $binds = array(1, 'test'); > $db->query($sql, $binds); > echo $db->lastInsertId('messages'); // works > > But when i use Zend_Db_Table the last insert id is always is zero: > > $mMessages = new Model_Messages(); > $row = $mMessages->createRow(); > $row->iduser = 1; > $row->message = 'test message'; > $row->save(); > > And this exception is shown : *"Cannot refresh row as parent is > missing"*because the "save" method is trying to refresh the row from the > database but > with no ID is unable to get the row. > > Any clue? > > -- > Xavier Vidal Piera > Enginyer Tècnic Informàtic de Gestió > Tècnic Especialista Informàtic d'equips > [EMAIL > PROTECTED]<http://www.nabble.com/user/SendEmail.jtp?type=post&post=18010441&i=3> > [EMAIL > PROTECTED]<http://www.nabble.com/user/SendEmail.jtp?type=post&post=18010441&i=4> > http://web.xaviervidal.net > 610.68.41.78
