Skip navigation
linksdesign
Currently Being Moderated

Detail page in Master Detail set displaying info from wrong row in mySQL

Feb 21, 2013 4:20 AM

Tags: #wrong #database #mysql #master #set #row #detail

I have set up a Master Detail page set using a mySQL relational database. There are three tables in the database: provider, benefit and category. The Master page works fine, displaying the information I've chosenfrom each of the tables. The Advanced Recordset on the Master page is as follows:

 

SELECT benefit.BenefitName, benefit.BenefitDesc, benefit.MinMembers, benefit.MaxMembers, benefit.SpecialTerms, benefit.Connectivity, benefit.OnlineProcessing, benefit.OnlineTutorial, benefit.Contact, provider.Company, provider.CompanyInfo, provider.LogoL, provider.LogoS, category.Category, benefit.BenefitID

FROM benefit, provider, category

WHERE provider.ProviderID = benefit.ProviderID AND category.CategoryID = benefit.CategoryID

ORDER BY provider.Company

 

The Detail page should show information pulled from both the benefit and provider tables. However, although the benefit details display correctly, the details coming from the provider tables only ever show the info from the first row in the table. The recordset on the Detail page (autogenerated by Dreamweaver) is as follows:

 

SELECT benefit.BenefitName, benefit.BenefitDesc, benefit.MinMembers, benefit.MaxMembers, benefit.SpecialTerms, benefit.Connectivity, benefit.OnlineProcessing, benefit.OnlineTutorial, benefit.Contact, provider.Company, provider.CompanyInfo, provider.LogoL, provider.LogoS, category.Category, benefit.BenefitID, provider.ProviderID

FROM benefit, provider, category

WHERE BenefitID = colname

 

I'm by no means an expert with PHP or mySQL, but having done a lot of searching online I think this is something to do with needing to add another parameter manually on the Detail page, but I'm not sure how or where to do it. Can anyone help? I need to get the site live in the next few days and it's driving me nuts!

 

Thanks

Margaret

 
Replies
  • Currently Being Moderated
    Feb 21, 2013 11:51 AM   in reply to linksdesign

    >The recordset on the Detail page (autogenerated by Dreamweaver) is as follows:

     

    That recordset SQL is wrong - it is missing the joins for the tables that you showed in the first SELECT statement in your post - so your recordset is returning a cartesan product. Scan the entire contents of the page and make sure that you don't have duplicate recordset code - DW sometimes does this. Then you will need to fix your SQL so that the tables are joined properly.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points