The tutorial is either has several things left out or it is operator error.
1. the cfdump does not work - it returns nothing.
2. Attribute validation error for tag cfoutput error returns nothing.
I work with Fireworks and DW but I am new to CF. This tutorial does not look
difficult but when not much of what they give us works - it is very frustrating.
Thanks my code is below.
<CFIF #ParameterExists(Add)# is "Yes">
<cfquery NAME="artwork" datasource="cftutorial">
SELECT FIRSTNAME, LASTNAME, ARTNAME, DESCRIPTION, PRICE, LARGEIMAGE, ISSOLD,
MEDIATYPE
FROM ARTISTS, ART, MEDIA
WHERE ARTIST.ARTISTID=ART.ARTISTID
AND ART.MEDIAID = MEDIA.MEDIAID</cfquery>
<!--- <cfdump var=#artwork#> --->
</CFIF>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Art Gallery Pieces</title>
</head>
<body bgcolor="##0066CC">
<img src="images/logo.gif" width="140" height="45">
<br><br>
<table border="0" cellpadding="15" cellspacing="0" bgcolor="##FFFFFF">
<cfoutput query="artwork">
<tr>
<td valign="top" align="center" width="200">
<img src="images/#artwork.LARGEIMAGE#"width="200" height="200"><br>
<strong>#artwork.artName#</strong><br>
Artist: #artwork.firstName# #artwork.lastName#<br>
Price: #artwork.price#<br>
#artwork.mediatype# - #artwork.description#<br>
<font color="##FF0000">#artwork.isSold#</font></td>
</tr>
</cfoutput>
</table>
paross1 - 30 May 2006 18:48 GMT
Is your query even returning anything?
rockhiker - 30 May 2006 19:03 GMT
No the query does not return anything.
rockhiker - 30 May 2006 19:12 GMT
No the query has not returned anything yet.
paross1 - 30 May 2006 20:20 GMT
Well, if your query isn't returning anything, then you won't be seeing any
output, either using the CFOUTPUT or CFDUMP methods. Is there any data in your
database? Are you able to query your datasource outside of ColdFusion to see if
it is your query that is at fault, or perhaps you have no matching data in your
database.
Phil
rockhiker - 30 May 2006 20:36 GMT
The cftutorial database has data and I tested the database connection- it was
good. I removed the WHERE clause and the error :The value of the attribute
query, which is currently "artwork", is invalid.
paross1 - 30 May 2006 20:39 GMT
What happens if you just try to view the output of the query using CFDUMP and comment out the rest of the code (or CFABORT after CFDUMP)?
Phil
rockhiker - 30 May 2006 20:51 GMT
I used CFDUMP and commented out the rest of the code- I previewed page and nothing was returned.
thks
paross1 - 30 May 2006 21:07 GMT
Even without a WHERE clause? If so, you have no DATA coming from your QUERY, which probably means nothing in the database.
rockhiker - 30 May 2006 21:15 GMT
Even without a where clause and I checked the tables in the database - they all contain several rows.
jim
paross1 - 30 May 2006 21:18 GMT
So, what do you get when you run this?
<cfquery NAME="tbl_count" datasource="cftutorial">
SELECT 'artists' AS tbl_type, count(*) AS cnt
FROM artists
UNION
SELECT 'art' AS tbl_type, count(*) AS cnt
FROM art
UNION
SELECT 'media' AS tbl_type, count(*) AS cnt
FROM media
</cfquery>
<cfdump var="#tbl_count#">
Phil
rockhiker - 30 May 2006 21:23 GMT
I got a result set listing
45 art
10 artists
8 meida
paross1 - 30 May 2006 21:38 GMT
I think that this is what is messing you up <b><CFIF #ParameterExists(Add)# is
"Yes"></b> The ParameterExists() function is deprecated, and you should be
using IsDefined, and you should have written it like this:
<CFIF #IsDefined(Add)>
If you also want to check the <i>value</i> of Add, then you also need to
include a check to see if it has the appropriate value, something like this:
<CFIF #IsDefined(Add) AND Add EQ "Yes">
At any rate, I believe that you are skipping the entire query because your
CFIF statement is never TRUE.
Phil
rockhiker - 30 May 2006 21:47 GMT
I got rid of the <CFIF #ParameterExists(Add)# is "Yes"> and the <cfdump> worked fine.
Thanks for your patience and help
Jim
paross1 - 30 May 2006 21:56 GMT
Sorry that it took so long. I was focusing on your query and didn't even stop to look at the CFIF tag that controlled access to the dang thing!
Phil