SunQuest
           ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old October 24th, 2004, 07:09 PM
myhomie myhomie is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 20 myhomie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Pulling up data from a page that has lists of people with one button by the name

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!

Reply With Quote
  #2  
Old October 24th, 2004, 09:15 PM
Alas's Avatar
Alas Alas is offline
Wickedwd.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: wickedwd.com
Posts: 182 Alas Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 16 h 41 m 17 sec
Reputation Power: 0
Thumbs up Alas = tha man

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

Reply With Quote
  #3  
Old October 25th, 2004, 02:49 PM
myhomie myhomie is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 20 myhomie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
person id

Quote:
Originally Posted by Alas
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



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!

Reply With Quote
  #4  
Old October 25th, 2004, 03:11 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,611 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 10 m 21 sec
Reputation Power: 53
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

Reply With Quote
  #5  
Old October 25th, 2004, 03:25 PM
myhomie myhomie is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 20 myhomie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question query problems

<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....

Reply With Quote
  #6  
Old October 25th, 2004, 03:31 PM
wdn2000's Avatar
wdn2000 wdn2000 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Apr 2000
Posts: 1,058 wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 Days 20 h 56 m 43 sec
Reputation Power: 16
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>

Reply With Quote
  #7  
Old October 25th, 2004, 06:43 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,611 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 10 m 21 sec
Reputation Power: 53
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.

Reply With Quote
  #8  
Old October 25th, 2004, 07:24 PM
myhomie myhomie is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 20 myhomie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
so the query will be....

Quote:
Originally Posted by wdn2000
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>




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?

Reply With Quote
  #9  
Old October 25th, 2004, 07:35 PM
wdn2000's Avatar
wdn2000 wdn2000 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Apr 2000
Posts: 1,058 wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level)wdn2000 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 6 Days 20 h 56 m 43 sec
Reputation Power: 16
Quote:
Originally Posted by myhomie
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?


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.

Reply With Quote
  #10  
Old October 27th, 2004, 04:00 PM
machito machito is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 34 machito User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 10 m 17 sec
Reputation Power: 4
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>

Reply With Quote
  #11  
Old October 27th, 2004, 04:41 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,611 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 10 m 21 sec
Reputation Power: 53
<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.

Reply With Quote
  #12  
Old October 28th, 2004, 08:59 PM
Alas's Avatar
Alas Alas is offline
Wickedwd.com
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2004
Location: wickedwd.com
Posts: 182 Alas Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 16 h 41 m 17 sec
Reputation Power: 0
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > Pulling up data from a page that has lists of people with one button by the name


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |