This topic is locked

Parent Child Listing Issue

11/12/2011 9:42:59 PM
PHPRunner General questions
C
cjsaputo author

Parent listing screen is supposed to show the number of child records on the listing screen only when there is a matching child recored by ID field. This actually works, almost. The problem is that the parent record shows on the list screen as many times as there are child records. The child record count is correct on each parent record.
In other words, if there are two child records, the matching parent record will show twice on the listing screen with the child record count showing (2) on each.
I am using PHP Runner. Is this a join problem?

C
cgphp 11/13/2011

In the Visual editor tab, Reset (http://xlinesoft.com/phprunner/docs/toolbar.htm) the list page.

C
cjsaputo author 11/13/2011



In the Visual editor tab, Reset (http://xlinesoft.com/phprunner/docs/toolbar.htm) the list page.


Did that, no change.

C
cgphp 11/13/2011

Post a demo link or a screenshot.

C
cjsaputo author 11/13/2011



Post a demo link or a screenshot.


Cristian,
You look trustworthy. The link below is my production system. Since this is a public forum I have temporarily changed the user/pw to admin/admin. The problem is in the "Members" table. It is supposed to link to the "Donors" table by field "donorid", which is in both tables. If you page to the third screen you can see that member "Bernard" shows twice. In fact there is only one record in the Members table, but two records in the Donor table. Please let me know when you have seen what you need so that I can reset the security.
mibarn.net/Resource Maintenance/output

C
cgphp 11/14/2011

Which version of PHPrunner are you using ? Post the join query.

C
cjsaputo author 11/14/2011



Which version of PHPrunner are you using ? Post the join query.


V6.0, Build 9873
SELECT

members.rownum,

members.first_name,

members.last_name,

members.company,

members.street,

members.city,

members.state,

members.zip,

members.county,

members.phone,

members.cell,

members.fax,

members.email,

members.renewaldate,

members.expiredate,

members.membertype,

members.paidamount,

members.paytype,

members.checkno,

members.comments,

members.label,

members.memberdate,

members.donorid,

donors.datedonated,

donors.amountdonated,

donors.comments AS comments1,

donors.donorid AS donorid1

FROM members

LEFT OUTER JOIN donors ON members.donorid = donors.donorid

ORDER BY members.last_name, members.first_name

C
cgphp 11/14/2011

The query seems correct but why are you joining the two tables ?

When you use an outer join, if there is no data found in the right table which matches data from the left table the left table data is still returned with NULLs put in for all right-table data. In this case you can do a select without join clause:

SELECT

members.`rownum`,

members.first_name,

members.last_name,

members.company,

members.street,

members.city,

members.`state`,

members.zip,

members.county,

members.phone,

members.cell,

members.fax,

members.email,

members.renewaldate,

members.expiredate,

members.membertype,

members.paidamount,

members.paytype,

members.checkno,

members.comments,

members.`label`,

members.memberdate,

members.donorid

FROM members

ORDER BY members.last_name, members.first_name