I have a question.
I have three tables for example, person, skill, person_skill.
I have to create update function using coldfusion.
I have to display a check within the checkbox for which skill that a selected person already has which means on the first page, I have to enable user to select which person's information the user wants to update. Then next page I have to display that person's information. For example, person a has skills in Visual Basic, C++. Then there is a check in the check box next visual basic, and C++. Other skill checkbox such as coldfusion, html, do not have check in the checkbox next to them.
Does anyone know how to tell the code to look at every record of that person in the table person_skill and display only one checkbox next to every skill no matter that person has that skill or not. The difference just is to show the check or leave the box blank
You will need to use the <cfquery> element to execute an SQL query to extract records from your tables.
That is a basic idea of how you would select all the records for a person out of your table. Obviously, you will have to edit the query so it complies to your databases naming conventions. And your DSN.
<cfquery name="get_data" datasource="#your_dsn#" username="#db_user#"
SELECT * FROM person_skill WHERE nameField = '#Form.name#'
thank you, but not what I am asking
I think I did not explain clearly enough.
I did create a query like that in my code. My main problem is other thing.
For example, the person_skill table contain
personID 1 has skillID A
personID 1 has skillID B
personID 1 has skillID K
When that person loggin. I have to display check within the checkbox next to skill A, B and K. Also, I have to put checkbox next to other skills but with no check inside.
The purpose of that is to allow that person to update his skill. He can keep the skills by keeping the check within the checkbox. Otherwise, he can make check other skills that he wants to add in his record.
I try to use cfloop.
However, it display one checkbox with check and one without check next to skillA, B, K. This is not what I want. I just want it to have one checkbox with check inside next to those skill that person has.
here is the code that I used
<cfif #showperson_skill.skillID# EQ 'A'>
<cfinput type="checkbox" name="skillID" value="A" check="yes">
<cfif #showperson_skill.skillID# NEQ 'A'>
<cfinput type="checkbox" name="skillID" value="A">
Here is the query:
<cfquery name="showperson_skill" datasource="dsn">
select personid, skillid
where personid = #form.loggin_personid#
If anyone knows how to solve it, please let me know. Thanks.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)