|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
After doing a search (using drop downs, text boxes, etc.) I get a web page that returns the matches from the database table (A). It lists the names of the people and has a button next to them (I used a post-form submit button- not sure that's the way to go).
I want to be able to click on the button next to the person's name and view the rest of the attributes for that person in the database table (A). I wasn't sure if I was doing the button right, and I am not quite sure how to use the SQL and coldfusion with it. I didn't know if I needed the Distinct, Check, Exist, Any, Count, Open, or Fetch SQL statements on that page. Or if I needed to add to the button something to do with the first or last name of the person. Any leads or guidance would be appreciated! Thanks! |
|
#2
|
||||
|
||||
|
I would hyperlink the name of the person like this
Code:
<a href="PersonProfile.cfm?PersonID=#URLEncodedFormat(Trim(PersonID))#">#NameofPerson#</a> then in PersonProfile.cfm the Query should be... Code:
<CFQUERY NAME="Alas" DATASOURCE="IsThaMan"> SELECT * FROM TableName WHERE PersonID = #URL.PersonID# </CFQUERY> After this all u got to do is CFOUTPUT your variables There u go all done. PS. got a question for u...how do u make a back button... i already did what u r trying to do but when i get to a person's profile i want a button that takes me back to the list of people, ie. does what the back button on explorer would do. -Alas |
|
#3
|
|||
|
|||
|
person id
Quote:
I got an error that says: An error occurred while evaluating the expression: #URLEncodedFormat(Trim(PersonID))# This is my code - <a href="alumnadetails.cfm?PersonID=#URLEncodedFormat(Trim(PersonID))#">#firstName# #lastName#</a> I don't have a personID field though, how did you create that, or could I use the one of the name fields? I'm not sure about the back button yet. However, I used it before, and it worked...but once I get this working I will try to help you out! |
|
#4
|
|||
|
|||
|
You'll use whatever the ID field is from your query to pass to the next page. This way you can tell the application which specific record you want to look at.
By the way, all of these sorts of things are covered in great detail both in the CF documentation and in the many books on the subject. Ben Forta's books in particular are widely praised. You might think about grabbing one, it will help a great deal.
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums |
|
#5
|
|||
|
|||
|
<CFQUERY NAME="AB" DATASOURCE="COOL">
SELECT * FROM A WHERE firstName = '#URL.fname#' AND lastName = '#URL.lname#' </CFQUERY> This is what I have for the query. I think that I solved the problem with the URL on the previous page (this is what I have instead of PersonID)... <td width="170"><div align="left"><a href="ails.cfm?fname&lname=#URLEncodedFormat(fname&lname)# #firstName# #lastName#">#firstName# #lastName#</a></a></div></td> However, I keep ketting an error message on the ails.cfm page with the query that says: #URL.fname# The specified URL parameter cannot be found. So I have been trying a bunch of different things, but I am sure it is a minor syntax error? Any help.... |
|
#6
|
||||
|
||||
|
This is somewhat simplified. Feel free to add the URL encoding back into it.
<a href="ails.cfm?fname=#firstName#&lname=#lastName#>#firstName# #lastName#</a> |
|
#7
|
|||
|
|||
|
Your URL must have name/value pairs to pass the variables to the target page. And seriously, this is extremely fundamental stuff so if you're having problems with this, I strongly urge you to grab Forta's book. You'll pick this up (and a whole lot more) much, much more quickly than struggling through it.
|
|
#8
|
|||
|
|||
|
so the query will be....
Quote:
So if I do this one...then the query would be.....? <CFQUERY NAME="AB" DATASOURCE="COOL"> SELECT * FROM A WHERE firstName = '#fname#' AND lastName = '#lname#' </CFQUERY> or would I combine first and lastname together? |
|
#9
|
||||
|
||||
|
Quote:
er... I think so. I only followed what you had posted before. I typically don't change variable names as it just confuses me. In certain circumstances (like user admin apps) you can't use the same names or you'd end up modifying yourself, but in most other cases I'd call first name fname everywhere, in the database, in the form, etc. It's perfectly allowable to use: <a href="ails.cfm?fname=#fname#&lname=#lname#>#fname# #lname#</a> if fname and lname are what you choose to use. I agree with kiteless in regards to getting the basics before trying to tackle too large of a project. I don't mind helping people out when they need a nudge in the right direction, but it seems like you need more of the fundamentals at this point. I have one of Forta's books and it does it good job of covering the basics. |
|
#10
|
|||
|
|||
|
deleting multiple files
Hello everyone:
Can the code below be used to delete multiple images at once? Each imageID will be passed with a checkbox, then a single click should handle the operation. <a href="delete.cfm?imageID=#URLEncodedFormat(Trim(thisID))#">Delete</a> <CFQUERY NAME="Alas" DATASOURCE="IsThaMan"> DELETE * FROM images WHERE ImageID = #URL.imageID# </CFQUERY> |
|
#11
|
|||
|
|||
|
<CFQUERY NAME="deleteImages" DATASOURCE="MyDSN">
DELETE FROM images WHERE ImageID IN ( listQualify( form.checkboxFieldName, "'" ) ) </CFQUERY> This turns the comma-delimited list of ID's submitted in the form (something like 4,16,22,81) into a single-quote-qualified list (like '4','16','22','81'), which you then feed into an IN clause in the query. |
|
#12
|
||||
|
||||
|
Kiteless is right u dont need to say Select * From X when u delete all u need is to say where id = X
PS. If you think this comment was completely unnessesary, your completely correct. ![]() |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > ColdFusion Development > Pulling up data from a page that has lists of people with one button by the name |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|