Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to output query results inside another query results in chekboxes? 1

Status
Not open for further replies.

olchik

Programmer
Jan 6, 2006
93
US
Hello,
Please help me with this problem. I need to make an update form in which I have to display all available courses (checkboxes named "courseID" with courseID in value) and at the same time I need to check those boxes that student already registered for.
Here are my queries

<cfif ParameterExists(URL.Stu_ID)>
<cfquery name="find_student" datasource="#sourse#">
SELECT *
FROM registration INNER JOIN
Students ON registration.stu_ID = Students.Stu_ID INNER JOIN
Courses ON registration.courseID = Courses.CourseID
where registration.Stu_Id = #URL.stu_ID#
</cfquery>
</cfif>
<cfquery name="getcourses" datasource="#sourse#">
select * from courses
</cfquery>

When I try to output I have this code:

<cfoutput query="getcourses">

<tr>
<td valign="top">
<input type="Checkbox" name="CourseID" value="#getcourses.courseID#" <cfif ISDefined("find_student.courseid<Cfloop query="find_student"><cfif #find_student.courseid# is #getcourses.courseID#>checked</cfif></CFLOOP></cfif>>

</td>
<td><font face="Verdana, Arial, Helvetica, sans-serif" size=2>#getcourses.coursename#</font> <br></td></tr>
</cfoutput>

I don't get the result I need.
If you have an idea what I am doing wrong, please help!!!

Thank you!
 
GOT IT!!!!!!!!!! IT WORKS!!!!!!

Thank you! Thank you! Thank you! Thank you! Thank you!

 
imstillatwork, good thinking. It's odd that I did something like that for my instructors page but couldn't make the distinction that this is what olchik wanted. This is why tek-tips is so great.

____________________________________
Just Imagine.
 
Yeah, this is one of those things that I had done in some crazy way before, and shortened it down to this when I realized what I had been doing.

I am always looking for the EASIEST way to do things now.

Kevin
 
imstillatwork, its funny how progammers/developers always do the hard way first THEN do the easy way. When I did my instructers page last week I tried to UPDATE the list but then ran into problems when the user selected more instructors then the original. Naturally that would be probematic, then it hit me. DELETE the old list and then INSERT the new one.

LOL...

Don't know where you are, but in NYC right now it is awesome weather. Just went for a walk on campus and almost didn't wanna come back, lol...

____________________________________
Just Imagine.
 
Yep...I am in NYC..Gorgeous outside! Didn't want to come back either :)
Thanks a lot for all your help again!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top