PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 28th, 2000, 02:59 PM
mwandrei mwandrei is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 9 mwandrei User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I'm developing a database that holds information about crew members. There are 7 categories of service types. Crew members can be associated with any number of categories.

I'm working on an update form to add or delete categories for a crew member. I first issued a query to find the member's categories. I issued a second query to list all possible categories. I want to show a checkbox for any possible categories that aren't in the member's individual category list. If the member is in categories 1 and 2, but not in 3 or 4, I want to show a checkbox for categories 3 and 4.

I can get the two category lists to print, but I can't figure out how to compare them.

Here is the code I have for the select statements:

Generates the list of member categories:
$cat_query = "SELECT crew_category.crew_id, crew_category.category_id, category.category_desc
FROM crew_category, category
WHERE crew_category.crew_id = "$crew_id" and crew_category.category_id = category.category_id";

$cat_result = mysql_query($cat_query);


Generates the list of all possible categories:
$all_cat_query = "SELECT category_id
FROM category";

$all_cat_result = mysql_query($all_cat_query);


I'm just developing my programming skills (as I'm sure you can tell), so I apologize for my ignorance! Thanks in advance to anyone who can help!

Reply With Quote
  #2  
Old June 29th, 2000, 01:28 AM
Shiju Rajan's Avatar
Shiju Rajan Shiju Rajan is offline
.Net Developer
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: London
Posts: 987 Shiju Rajan User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 26 m 22 sec
Reputation Power: 14
Send a message via MSN to Shiju Rajan Send a message via Yahoo to Shiju Rajan

<< I want to show a checkbox for any possible categories that aren't in the member's individual category list. If the member is in categories 1 and 2, but not in 3 or 4, I want to show a checkbox for categories 3 and 4.
>>

Actually i am not clear your rquestion.


<<
crew_category.category_id = category.category_id";
>>

you have already comparing the id's of both the tables.I don't understand why you are doing a matching again.



------------------
SR -
webshiju.com

"The fear of the LORD is the beginning of knowledge..."

[This message has been edited by Shiju Rajan (edited June 29, 2000).]

Reply With Quote
  #3  
Old June 29th, 2000, 08:56 AM
mwandrei mwandrei is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2000
Posts: 9 mwandrei User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The purpose of the form is to edit the crew member's category information. The category table holds only the category_id and the category title. The crew_category table is a link table that holds the crew_id and the category_id (So we can add categories later).

The form displays the current categories for that crew member. If a member has entries in the crew_category table for categories 1 and 2, these will display. I want to allow the user to select categories to add for this member only for categories that don't exist for that member.

As an example, a member has the following entries in the crew_category table:
crew_id = 10, category_id = 1
crew_id = 10, category_id = 2

I want the update form to display checkboxes for categories 3,4,5, etc., but NOT for categoris 1 or 2, so categories 3,4,5 can be added.

I'm trying to compare the results of the crew_category lookup with the categories table to see what categories don't exist for this person.

Sorry about the confusion. I know what results I want, I just don't know how to go about it (or how to explain it)!

Thanks!


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPHP Development > Comparing array values

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap