Re: Db_dataobject insert()
| From: | mishal at centrum dot cz | Date: | Thu, 27 Jan 2005 19:10:35 +0000 |
| Subject: | Re: Db_dataobject insert() | ||
| References: | 1 2 3 4 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17221@lists.php.net to get a copy of this message | ||
Hello Justin,
JP> Did you set up that field as the primary key? Is it an auto_increment
JP> value? What's this table's entry in your db.ini file look like? (both
JP> the table and its keys)
Yes, it set as primary key, auto increment, int(11)
[mailinglist_subscribers]
subscriber_id = 129
name = 2
email = 130
[mailinglist_subscribers__keys]
subscriber_id = N
>>
>> what's wrong?
>>
>> Thank you
>>
>> Michi
>>
>> JP> On Wed, 26 Jan 2005 16:33:04 +0100, mishal@centrum.cz <mishal@centrum.cz>
>> JP> 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