close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

One to many query

Thread began 10/31/2010 6:20 am by twitchr377598 | Last modified 11/03/2010 6:52 am by twitchr377598 | 2657 views | 11 replies

twitchr377598

One to many query

Well my friends, I have been pulling my hair out for over a day and I finally had to admit I needed help. I haven't had much experience with one to many relationships and this particular query is driving me batty and I don't think any of my Webassist extensions can help me with this one...haha

Ok, I am generating some checkboxes via a table like so:

php:
<?php do { ?>

              <input <?php if (!(strcmp($row_venues_RS['userID'],116))) {echo "checked=\"checked\"";} ?> name="venueID_<?php echo $row_venues_RS['venueID']; ?>" id="venueID_<?php echo $row_venues_RS['venueID']; ?>" type="checkbox" value="<?php echo $row_venues_RS['venueID']; ?>" />
              <?php echo $row_venues_RS['venueName']." ".$row_venues_RS['venueID']; ?><br />
     
<?php } while ($row_venues_RS mysql_fetch_assoc($venues_RS)); ?>



This query almost works. The proper venue (or venues) is checked, but as you can guess I get duplicates:

php:
SELECT venues.venueID, venues.venueName, venue_user_access.userID FROM

  venues INNER JOIN venue_user_access USING (venueID) WHERE venues.venueMasterID = %s AND venueStatus = 1 ORDER BY venueName ASC



These checkboxes are on an update record page so my goal is to show all venues tied to the venueMasterID (the value is stored in a sessions variable) from the venues table and check the ones that userID 116 has access. The access table essentially has a venueID and userID field. Is this possible with a single query? I haven't written a lot of complex ones therefore I may be missing some function to make this easier.

I have read up on and tried DISTINCT and GROUP BY, but never got the results I desired. So anyway, I am posting on the chance someone has an idea.

Thanks in advance,
Twitch

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...