This content has been marked as final. Show 6 replies
First, if you need to verify login has completed first, you should run the check in the application.cfm file so there is no way for anyone to access anyone else's data. ... that's slightly another topic however.
To grab a user's info based on a passed URL variable, you should use:
Your examples above have no relational pairs, just the variable or the result, but not both.
In "mypage" you would then run a query like
WHERE TableColumn = #url.contactID#
I'm sorry if I wasn't clear enough. I have tried what you suggested but what I forgot to mention is that I am querying from multiple tables bu using INNER JOIN. These tables have their own unique IDs. I have a main table, TableContactList, with the primary key contactID. The other tables are related to the main table and they contain names from the TableContactList, where contactID = Table2ID, Table3ID, Table4ID. So if I use contactID=#contactID#, how will the query know to get/display the record where contactID = Table2ID = Table3ID = Table4ID.
If I use the URL syntax, the same error comes up where contactID is undefined. I also tried this:
In addition, my main table, ContactList, should I put the hyperlink from there and just put a login restriction on that query page before displaying this: mypage.cfm?contactID=#contactID# I did this as well, but still didn't get to display the specific record I want.
Any other suggestions, please let me know.
Well, query aside, you need to use a proper URL setup to pass the ID to the query, which would be " mypage.cfm?variable=ID"
As long as you do that, then your issue will lie in the construction of your query
If you post your actual query code (that is found in mypage.cfm) then there are a lot of DB junkies here that can likely see what the issue may be in getting the actual output you want.
I would start the testing process by using a hard-coded URL with an ID that you know what to expect for output from. After you get the result pages to work properly you can add back in the login process etc., since that will not really change anything. Multiple joins can sometimes be a headache to figure out the issue.
Here is a more detailed explanation. Sorry it took too long. Anyway,
not sure if I need cfparam because I only want to display one record at a time and not the entire query:
<cfparam name="MaxRows" default="1"> <cfparam name ="StartRow" default="1">
I actually have about 7 tables that I need to get information from, displaying several columns from each of them. Is INNER JOIN a good choice to use to display all of the info I need (all tables except the contact list contain dates)? Anyway, here's the code I've started:
<cfquery name="qryIndividual" datasource="dshmat">
SELECT ContactList.ContactID, ContactList.FirstName, ContactList.LastName, BIO.InitialRef2006, BIO.Bsfty2005, HWG.hwg2006, HWG.hwg2005
FROM (ContactList INNER JOIN BIO on ContactList.ContactID=BIO.BioID) INNER JOIN HWG on ContactList.ContactID=HWG.hwgID
ORDER BY ContactList.LastName
This is the output that I am trying to display. But I'm stuck as to how to tell the DB to display a specific record if username and password are valid entries. If username is jdoe, then display jane doe's record only.
FirstName LastName | InitialRef2006 | Bsfty2005 | hwg2006 | hwg2005
jane doe 4/1/2006 6/5/2005 2/5/2006 8/6/2005
I have login page, and this is where I want to initiate the query to display the right record of that individual.
Any suggestions on where to start?
Well karla, I got two words for ya.
I still need your help in figuring out how I would present his/her data if his/her login matches his/her record...do i initiate this on the login page or the results page? help! Dan B mentioned 'where' clause . I already have where clause on the results page about displaying the information if all their IDs match each other...
The #url.columname# give me an undefined error on the URL. not sure why this is...help!
"Firstname_Lastname" is hyperlinked to the myrecord.cfm hoping to display Firstname_Lastname's record only. But before getting to his/her record, I need to authenticate that person...
any other suggestion on what I can do to display that person's personal record...*yes i am new at coldfusion*