URL parameter issue
Below #name# displays the correct information from the gather table.
For instance, if pearl is logged in with users.userID = 5, then #name# displays mek, tiff which is correct.
But,in the a href, display_graphic2.cfm?userID=5 for both mek and tiff. And I need it to equal the userID that is in the users table so clicking on mek would link to: display_graphic2.cfm?userID=4 and tiff would link to: display_graphic2.cfm?userID=3
How can I do this?
gather table data
users table data
<cfquery name="matches" datasource="gifts">
SELECT gather.name, gather.gatherID, users.userID
FROM gather INNER JOIN users
WHERE gather.gatherID=<cfqueryparam cfsqltype="cf_sql_integer" value="#session.userID#">
See: <cfoutput query="matches"><a href="display_graphic2.cfm?userID=#userID#">#name#</a>,
changed my query to JOIN on name not ID:
SELECT gather.gatherID, gather.name, users.userID
FROM gather INNER JOIN users ON gather.name=users.name
WHERE gatherID=<cfqueryparam cfsqltype="cf_sql_integer" value="#session.userID#">
loop through the output of the query until you find the matching record and then <cfoutput> the variable and exit the loop.
ok hey looks like you've solved it with the query / joins. Cool. that's a little slicker than my method, but it goes to show there are multiple ways to get stuff done.:p