www.webdeveloper.com
Results 1 to 3 of 3

Thread: coldfusion

Hybrid View

  1. #1
    Join Date
    Apr 2004
    Posts
    3

    coldfusion

    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

    Thanks

  2. #2
    Join Date
    Jan 2004
    Location
    Melbourne, Australia
    Posts
    5,298
    You will need to use the <cfquery> element to execute an SQL query to extract records from your tables.
    Code:
    <cfquery name="get_data" datasource="#your_dsn#" username="#db_user#"
    password="#db_pass#">
         SELECT * FROM person_skill WHERE nameField = '#Form.name#'
    </cfquery>
    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.

    Regards,
    Andrew Buntine.

  3. #3
    Join Date
    Apr 2004
    Posts
    3

    thank you, but not what I am asking

    Thanks.

    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
    <cfloop query="showperson_skill">
    <cfif #showperson_skill.skillID# EQ 'A'>
    <cfinput type="checkbox" name="skillID" value="A" check="yes">
    </cfif></cfloop>
    <cfif #showperson_skill.skillID# NEQ 'A'>
    <cfinput type="checkbox" name="skillID" value="A">
    </cfif>

    Here is the query:
    <cfquery name="showperson_skill" datasource="dsn">
    select personid, skillid
    from person_skill
    where personid = #form.loggin_personid#
    </cfquery>

    If anyone knows how to solve it, please let me know. Thanks.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles