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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old July 1st, 2004, 12:17 PM
DPVA94 DPVA94 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Richmond, Virginia USA
Posts: 9 DPVA94 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 17 sec
Reputation Power: 0
Send a message via ICQ to DPVA94 Send a message via AIM to DPVA94
"Element XXX is undefined in.." error.

I am a new user to this group and a new user to ColdFusion as well, so please forgive my naivety here.

I am trying to pull fields from my database and have links to each record with the code as follows:

<CFQUERY NAME="patients" DATASOURCE="febsetrack">
SELECT IECCenter, PTID, PTInitials, PtOnWeb, F1H01, F1H02, F1H03, F1H04, F1H05, F1H06, F1H07, F1H08
FROM FormReceiptTracking
WHERE PatID=#URL.PTID#
</CFQUERY>

<CFOUTPUT>
....
<tr>
<th scope="row">#PTID#</th>
<td>#PtOnWeb#</td>
<td>#F1H01#</td>
<td>#F1H02#</td>
<td>#F1H03#</td>
<td>#F1H04#</td>
<td>#F1H05#</td>
<td>#F1H06#</td>
<td>#F1H07#</td>
<td>#F1H08#</td>
</tr>
</table>
</CFOUTPUT>

When I try to test the page to see if it works, I get the following error every time:

Element PTID is undefined in URL. <br>The error occurred on line 5. (Line 5 being "WHERE PatID=#URL.PTID#)

Is there something not defined in my application.cfm file? Something that I have typed wrong (probably the case) or just plain beginner idiocy. I would appreciate any help that you could give me.

Sincerely,
DPVA94

Reply With Quote
  #2  
Old July 1st, 2004, 01:07 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,626 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 10 h 6 m 34 sec
Reputation Power: 53
You're not correctly passing in the URL variable, or else you are looking at the page and the URL variable is not defined. So make sure you are passing the URL value correctly, something like this:

http://mysite.com/mypage.cfm?ptid=10

You can also set up a default value for url.ptid to use if/when one is not specified in the url before you try to run the query:

<cfparam name="url.ptid" default="1" />

Hope that helps.
__________________
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
  #3  
Old July 2nd, 2004, 08:18 AM
DPVA94 DPVA94 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Richmond, Virginia USA
Posts: 9 DPVA94 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 17 sec
Reputation Power: 0
Send a message via ICQ to DPVA94 Send a message via AIM to DPVA94
Ok, I tried what you said....

These are the error messages that I get now...so it must be something that I have coded wrong somewhere in my beginner's innocence.

Error Executing Database Query. [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'PatID='. <br>The error occurred on line 8.

OR....

Error Executing Database Query. [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1. <br>The error occurred on line 8.

OR...

Element PTID is undefined in URL. <br>The error occurred on line 5.

Below is the code that I have for the cfquery, etc. Where the errors occurred. I put the <cfparam> line that you gave me in at the very beginning and after the query itself.

<!---Define URL.PTID variable--->
<!---I also put this line after the last cfquery tag to try that as well--->
<CFPARAM NAME="URL.PTID" DEFAULT="1" />

<!---Get a patient from the database--->
<CFQUERY NAME="patients" DATASOURCE="febsenewtrack">
SELECT IECCenter, PTID, PTInitials, PtOnWeb, F1H01, F1H02, F1H03, F1H04, F1H05, F1H06, F1H07, F1H08
FROM FormReceiptTracking
WHERE PatID=#URL.PTID#
</CFQUERY>

I appreciate your help.

Sincerely,
DPVA94

PS - Where are some really good places to go for beginners like me to get a strong foundation in CF basics?

Reply With Quote
  #4  
Old July 2nd, 2004, 08:44 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,626 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 10 h 6 m 34 sec
Reputation Power: 53
What kind of data type is the PTID field in the database? Is it a number, a character, a date...?

I'd highly recommend Ben Forta's books, they're how virtually every CF developer learned CF.

Reply With Quote
  #5  
Old July 6th, 2004, 12:12 PM
DPVA94 DPVA94 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Richmond, Virginia USA
Posts: 9 DPVA94 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 17 sec
Reputation Power: 0
Send a message via ICQ to DPVA94 Send a message via AIM to DPVA94
PTID is a text id, for example a patient would be named something like "2P010".

Reply With Quote
  #6  
Old July 6th, 2004, 01:07 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,626 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 10 h 6 m 34 sec
Reputation Power: 53
Then you'll need single quotes around it in the SQL, like this:

...
WHERE PatID='#URL.PTID#'


Once you have this working, you may want to look into using cfqueryparam, which creates a bind variable in the SQL statement. The appraoch you are using above has security issues (SQL injection attacks). But one thing at a time.

Reply With Quote
  #7  
Old July 7th, 2004, 08:22 AM
DPVA94 DPVA94 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Richmond, Virginia USA
Posts: 9 DPVA94 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 17 sec
Reputation Power: 0
Send a message via ICQ to DPVA94 Send a message via AIM to DPVA94
No kidding, pepper me with too much stuff at the same time, and my brain might explode.

I will try that today and see what happens. Nice thing is, I am getting my new laptop today and will have time to practice this stuff at home. ColdFusion is the first programming language that I have actually wanted to learn indepth, and I appreciate your help in starting the foundations of that. I am sure more questions will be coming your way.

Back to the grind!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > "Element XXX is undefined in.." error.


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway