Re: Db_dataobject insert()

From: Date: Thu, 27 Jan 2005 19:01:49 +0000
Subject: Re: Db_dataobject insert()
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17219@lists.php.net to get a copy of this message
Hello Justin, thank you for your reply. I tried to get the id as you adviced me, but still can't get the last insert id. :-( i allways get NULL. here's the dump of the dataobject: object(dao_mailinglist_subscribers)(14) { ["_DB_DataObject_version"]=> string(5) "1.7.2" ["__table"]=> string(23) "mailinglist_subscribers" ["N"]=> int(0) ["_database_dsn"]=> string(0) "" ["_database_dsn_md5"]=> string(32) "c4c6aece3258700efcf3495db2bb59d9" ["_database"]=> string(8) "osagenda" ["_query"]=> array(6) { ["condition"]=> string(0) "" ["group_by"]=> string(0) "" ["order_by"]=> string(0) "" ["having"]=> string(0) "" ["limit"]=> string(0) "" ["data_select"]=> string(1) "*" } ["_DB_resultid"]=> int(1) ["_link_loaded"]=> bool(false) ["_join"]=> string(0) "" ["_lastError"]=> bool(false) ["subscriber_id"]=> NULL ["name"]=> string(3) "foo" ["email"]=> string(11) "bar@bar.com" } what's wrong? Thank you Michi JP> On Wed, 26 Jan 2005 16:33:04 +0100, mishal@centrum.cz <mishal@centrum.cz> wrote: >> Hello, >> >> i have problems with db_dataobject insert() method. >> it should return the ID of the inserted element. >> i found in mailing list archive, that this problem was reported >> before. >> >> >> http://marc.theaimsgroup.com/?l=pear-general&m=110186296714930&w=2 >> >> i have installed db_dataobject version 1.7.2., >> use mysql 4.0.2. >> >> is this problem fixed? >> JP> The insert method does not return the ID AFAIK. It does, however, set JP> it in the DO. So somehting like: $do->>insert(); echo $do->>id; JP> should work. It's what I use. JP> -- JP> Justin Patrin -- Best regards, mishal mailto:mishal@centrum.cz

« previous php.pear.general (#17219) next »