close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

SQL query question

Thread began 7/30/2014 5:43 am by iainmacdonald331081 | Last modified 7/31/2014 1:11 pm by iainmacdonald331081 | 1560 views | 7 replies

iainmacdonald331081

SQL query question

I have a table of lodges and table of scores:

lodges
LodgeID (PK)
Lodge
etc

scores
ScoreID
Score
Question
LodgeID

For any given lodge, I have a page where the results can be viewed, with a list of all the categories.

I would like it only to display the categories where there are any scores (votes) in that category.

So I have a query WADAlodges on a page which refers to the lodges and scores tables for each category:

SELECT * FROM lodges INNER JOIN countries ON lodges.CountryID = countries.CountryID INNER JOIN scores ON lodges.LodgeID = scores.LodgeID WHERE lodges.LodgeID = %s OR ( -1= %s AND lodges.LodgeID= %s)

So it might return, for example,

LodgeID, Question
123, 1
123, 2
123, 3
etc

And I have some code to only display the text for each category, e.g.

<?php if ($row_WADAlodges['value']=="Yes" AND $row_WADAlodges['2015_Awards_Participant']=="Yes" AND $row_WADAlodges['Question']=="1"){ ?>

<?php if ($row_WADAlodges['value']=="Yes" AND $row_WADAlodges['2015_Awards_Participant']=="Yes" AND $row_WADAlodges['Question']=="2"){ ?>

<?php if ($row_WADAlodges['value']=="Yes" AND $row_WADAlodges['2015_Awards_Participant']=="Yes" AND $row_WADAlodges['Question']=="3"){ ?>

etc

But that only works for the first record in the query - how can I get it to work for other records for other scores?

Hope that makes sense, as I'm not sure I've explained it very well.

I have attached a copy of the page.

Thanks

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...