hey, its 2 hours away to your Friday!

Ok, first off, from the looks of it you are assuming you will always get one
record from this SQL, with your data this maybe a fair assumption, but be
careful of assumptions, they'll bite you someday in code.  I'm living proof
carrying many scars from the code dog.

Now, a couple things with this line:
<cfset desc1 = #Description1#>

1) You should always scope your variables, a few rare cases where you may
not want to, but this is definitely not one of them.  So change the line to
<cfset desc1 = #product.Description1# />
2) # use, you do not need pounds inside tags and functions unless you are
inside quotes, so change the above to
<cfset desc1 = product.Description1 />
3) Are you always 100% sure your SQL will return at least one row?  I'm
guessing in this case it is not.  So, need to wrap your line above in a
check for this
<cfif product.recordcount GTE 1>
   <cfset desc1 = product.Description1 />
</cfif>

That said, I'd urge you to use CFOUTPUT and its QUERY attribute, then you
can write code not worrying about 1 so much, depending on your situation of
course.  This would lead you to something like the below.  With this, no
need to use the cfset lines you have and this will work when the SQL has no
records returned.  Note also if the SQL returns more than one record, the
cfoutput will loop over all of them for you.

<cfoutput query="product">
 <tr bgcolor="##cccccc">
  <td><strong>: #form.sku# </strong> <br>
     #product.Desc1#
  </td>
  <td>#product.Vend_Name#</td>
 </tr>
 <tr>
  <td colspan="2">
    <font size="-2">#product.Description2#</font>

  </td>
  </tr>
</cfoutput>



HTH!

DK

On 3/8/07, Robert Reil <[EMAIL PROTECTED]> wrote:

Well we got somewhere in the WACK group tonight but did not quite reach
the
goal. I have a small problem with the following file, can anyone help me
figure out what is wrong with my call for my descriptions and vend name?

------------------------------
<cfquery name="product" datasource="carbs">
SELECT Description1, Description2, Vend_Name
FROM carbs.products
WHERE sku = '#FORM.sku#'
</cfquery>
<html>
<head>
<title>Product Search Results</title>
</head>
<body>
<cfset desc1 = #Description1#>
<cfset desc2 = #Description2#>
<cfset vendor = #Vend_Name#>

<!--- Display search text --->
<cfoutput>
<strong>SKU:</strong>
<table>
<tr>
  <th colspan="2">
   <font size="+2">
   Products
   </font>
  </th>
</tr>
<cfoutput>
  <tr bgcolor="##cccccc">
   <td>
    <strong>:
    #sku#
    </strong>
    <br>
    #Desc1#
   </td>
   <td>
    #Vend_Name#
   </td>
  </tr>
  <tr>
   <td colspan="2">
     <font size="-2">#Description2#</font>
  </td>
  </tr>
</cfoutput>
</table>
</cfoutput>
</body>
</html>

-----------------------------
Problem is that it gets stuck at:
Variable DESCRIPTION1 is undefined.

The error occurred in
C:\Inetpub\wwwroot\intranet.motorcyclecarbs.com\sales\form1_action.cfm:
line
20

18 : <body>
19 : <cfset sku=#form.sku#>
20 : <cfset desc1 = #Description1#>
21 : <cfset desc2 = #Description2#>
22 : <cfset vendor = #Vend_Name#>




-------------------------------------------------------------
To unsubscribe from this list, manage your profile @
http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------






--
Douglas Knudsen
http://www.cubicleman.com
this is my signature, like it?



-------------------------------------------------------------
To unsubscribe from this list, manage your profile @ http://www.acfug.org?fa=login.edituserform

For more info, see http://www.acfug.org/mailinglists
Archive @ http://www.mail-archive.com/discussion%40acfug.org/
List hosted by http://www.fusionlink.com
-------------------------------------------------------------

Reply via email to