473,385 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to include a specific form based on a record field?

1
Hi - I have a newbie question, not sure if I am going about this the right way...

I'm creating a web interface in Dreamweaver CS3, using PHP and MySQL. We are tracking different types of activities, and based on the activity type, the user has to answer a series of questions (different questions for each activity type).

I have the following tables set up:

ACTIVITIES
- activityID
- activityTypeID
- activityName
- activityDescription

ACTIVITY_TYPES
- activityTypeID
- activityTypeName

ACTIVITY_QUESTIONS
- activityQid
- activityTypeID
- questionText

ACTIVITY_ANSWERS
- activityAid
- activityID
- activityQid
- answerText

I have a detail page that displays info about a selected activity (activity name, type, description). I would like to display the questions form on this page, based on the activity type. What is the best way to do this?

Thanks so much!
Oct 6 '09 #1
2 1357
TheServant
1,168 Expert 1GB
Welcome to Bytes.
I think that what you want is MySQL JOIN. Have a look at that if haven't already and come back with any questions or give an example of what you want.

A more detailed example of a few more MySQL techniques are avaiable here to help you on your travels.
Oct 6 '09 #2
TheServant
1,168 Expert 1GB
After reading your question again, I think maybe this is qhat you want:
Expand|Select|Wrap|Line Numbers
  1. SELECT activity_types.activityTypeName, activity_questions.activityQid, activity_questions.questionText
  2. FROM activity_types, activity_questions
  3. WHERE activity_types.activityTypeID = activity_questions.activityTypeID
That should get you started as it will fetch the questions associated with each activity by matching TypeID's. After you get that under control, then you can be more specific in your WHERE clause and include a "AND activity_types.activityTypeID = '$selected' " or something like that to select specific ones.

Hope that helps.
Oct 7 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: BLUE WATER | last post by:
Help, When I am finished entering in data into my form A, I press the save button that saves this new data to a new record. However I would like my other form to open at a specific record, the...
2
by: RC | last post by:
I would like to go to a specific record based on what the user types in a text box on a form. I have a table named: Boxes in the table there is a field named: BoxNumber a form named: BxForm ...
25
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the...
4
by: the hotshot | last post by:
hello, this seems to be a hard question so far and noone has been able to help with this. is it possible to have access start an autonumber with a prefix according to the year when the data is...
3
by: david | last post by:
Hi, I've been reading tons of posts on how to copy records, but to no avail....i'm still stuck. There are three tables: Main, Sub-Form1 & Sub-Form2 I have a form which displays some data....
2
by: nkoske | last post by:
I have a form with a subform in datasheet view and I have a event on one of the fields in the subform, so that the user can double click it and go to expanded information based on that field. ...
1
by: Kevin Welch | last post by:
Looking for some expert help here. Caveat: I do not know SQL, and I've built a database basically by trial and error (unfortunately, I don't have much time to learn Access as I would want). ...
3
by: DavidB | last post by:
I want to be able to go to a specific record on my form when I open it. The record I want to go to will be dynamic based on the value currently stored in a global variable. The global contains...
3
by: mckbill | last post by:
Is there a way I can direct the cursor to a specific field (variable) in a form by typing the field name while in form view? I have a form with many fields, and it would be nice if there were...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.