Home arrow ColdFusion arrow Page 3 - Jump Start To ColdFusion MX
COLDFUSION

Jump Start To ColdFusion MX


Yearning to become a ColdFusion buff? If so, then start with this article -- Clint introduces us to ColdFusion MX using coding examples and great explanations.

Author Info:
By: Clint Tredway
Rating: 4 stars4 stars4 stars4 stars4 stars / 9
September 24, 2002
TABLE OF CONTENTS:
  1. · Jump Start To ColdFusion MX
  2. · What Is ColdFusion?
  3. · Showing The Results Of A Query
  4. · Looping In ColdFusion
  5. · Form Handling
  6. · Conclusion

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Jump Start To ColdFusion MX - Showing The Results Of A Query
(Page 3 of 6 )

Ok, now that we know how to query a database, let's see how we can show the results of that query. Remember the <cfoutput> tag we talked about earlier in this article? This tag will loop through a recordset when the query attribute is used. Here's how to set up the output of our query from earlier:

<cfoutput query="myQuery">
#col1# #col2#<br>
</cfoutput>


That's all you have to do to output a result set from a query -- It's that simple! Any HTML tag can be placed inside a <cfoutput> tag as well. For example:

<cfoutput query="myQuery">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>#col1#</td>
<td>#col2#</td>
<tr>
</table>
</cfoutput>


The <cfoutput> tag is a very powerful tag that has many cool features that are beyond the scope of this article. I will compose a more advanced article with these features explained in depth another day.

On the Winodws platform variables are not case sensitive. So myquery and myQuery refer to the same variable. You can have the same variable in different scopes though. I would not recommend doing this, but it is possible. For instance, you can have form.myvar and url.myvar, but this is not good coding practice -- I just wanted to state that it was indeed possible.

Sending Email
Sending email is a very common task that many developers have to do in many of the applications we build. In ColdFusion, sending email is very simple. Just like the other tags that we have used previously in this article, this tag is called what it does; <cfmail>. The <cfmail> tag is what allows developers to send email through their applications. Here is how to use this tag:

<cfmail from="me@me.com" to="you@you.com" subject="This is an email from ColdFusion">
Hello From ColdFusion MX!
</cfmail>


This will send an email to the 'to' address with the body of 'Hello From ColdFusion MX'. There are other attributes that this tag can use are bcc, cc, type (text or HTML), query, timeout, startrow, endrow, and many others. This is a powerful tag but it was not design to be a mail-sending engine -- there are third-party mail tags that are much better than the default <cfmail> tag but at least you do not have to buy a third-party tool to send mail out of the box.
blog comments powered by Disqus
COLDFUSION ARTICLES

- Adobe ColdFusion Just Got More RAD
- How to Access a SQL Anywhere Database with C...
- CFXML: Probing XMLDOM in ColdFusion
- Creating a Web Service with ColdFusion: the ...
- CFAjax: What it is and How to Use it
- Querying SQL 2000 Server from ColdFusion
- Introduction to ColdFusion Markup Language, ...
- Introduction to ColdFusion Markup Language
- Databases and Dreamweaver MX 2004, concluded
- Databases and Dreamweaver MX 2004
- Welcome to Coldfusion MX 6.1, concluded
- Welcome to Coldfusion MX 6.1
- What You Must Know About ColdFusion Flow-Con...
- What You Must Know About Operators in ColdFu...
- Everything You Must Know About ColdFusion Va...

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials