RE: [PEAR] DB - how to do toArray after join

From: Date: Fri, 14 Nov 2003 10:06:23 +0000
Subject: RE: [PEAR] DB - how to do toArray after join
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8914@lists.php.net to get a copy of this message
Hi! Hmmm - in my DataObject I do not find the field _join_field (var_dump) however I do find the fields themselves, as I said before. But I do not know how to get them out of the object because toArray does not do it. And - yes I know - there is an example with 3 tables in the manual (of course I checked before ...) But ... unfortunately the example does not do anything with the values (there is just a // do stuff) At least if you are talking about the example in joinAdd() Regards Daniel > -----Original Message----- > From: Arnaud Limbourg [mailto:arnaud.limbourg.prestataire@cegetel.fr] > Sent: Friday, November 14, 2003 10:47 AM > To: Daniel Kopp > Cc: pear-general@lists.php.net > Subject: Re: [PEAR] DB - how to do toArray after join > > > IIrc, > > dataobject creates a var named _join_field in which you have the data > from the joined table. > > You may have to do another toArray on that. > > Have a look at the pear manual, there is an example of a three tables > join there. > > Arnaud. > > Daniel Kopp wrote: > > > Hi! > > > > Am I making a mistake or why do I not get all the fields when I do: > > > > $table1=new DataObject_table1(); > > $table2=new DataObject_table2(); > > $table3=new DataObject_table3(); > > > > $table1->joinAdd($table2); > > $table1->joinAdd($table3); > > $table1->find(); > > while ($table1->fetch()){ > > echo "-------------Data---------------<BR>"; > > $data=$table1->toArray(); > > echo "<pre>"; > > var_dump($data); > > echo "</pre>"; > > } > > > > I only get the parameters of table1 BUT if I output the > object $table1 > > I see that the data is actually in there. So - how can I > get an array > > with all the collected data? Or do I need to get everything myself? > > Like this: > > > > $data['field1'] = $table1->field1; > > $data['field2'] = $table2->field2; > > ... > > echo "<pre>"; > > var_dump($data); > > echo "</pre>"; > > > > Any comments?

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