HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
With Allaire ColdFusion 4.5, you can build powerful, dynamic Web applications faster than you ever imagined! Learn ColdFusion 4.5 now, from professional Web developers, through real world projects with example code available from the companion Web site. Start with the basics, such as learning database fundamentals and setting up an Access database. Then master every element of a robust ColdFusion solution, from setting up your ColdFusion server through working with the most important ColdFusion tags and functions. Every project's code examples, database, and images are downloadable from the companion Web site. No other ColdFusion book gets you running this fast, or supports you this well!
You'll learn all this and much more-hands-on!
Look to Essential Books for ALL the Web Skills You Need!
All these books share the same great format and the same dynamic Web site ... so once you've used one, learning from the others is a piece of cake!
Database Basics for ColdFusion Developers
Click here for a sample chapter for this book: 0130406465.pdf
1. Database Basics.
A Look at Relational Databases. Introduction to SQL. To Quote or Not to Quote? Project I: Creating an Access Database File. Setting Up an ODBC Connection1. Windows Control Panel. ColdFusion Administrator. Project II: Retrieving Data. SQL Builder. Recap.
Commenting Your Code. Using Quotes. <CFPARAM>. Passing Variables. VARIABLES. URL. FORM. COOKIE. ATTRIBUTES. SESSION. CGI. APPLICATION. CLIENT. SERVER. Scope. Project I: Passing Variables Between Pages. <CFIF></CFIF>. <CFELSE>. <CFELSEIF>. Now Function. Date Functions. DateFormat. TimeFormat. Project II: Display Days Left Until a User-Defined Date. DateDiff. IsDefined. Replace. Project III: Using <CFLOOP>. Recap. Advanced Project.
Defining the Application File (application.cfm). <CFAPPLICATION>. <CFERROR>. Project I: Setting Global Values for Your Site. Project II: Defining Header and Footer Files. <CFINCLUDE>. Recap. Advanced Project.
Building an Administration Screen. Setting Up the Administration Screen. Project I: Viewing Items in Your Database. DollarFormat Function. CurrentRow. MOD. IIF. RecordCount. Project II: Uploading Files to Your Site. <CFFILE>. <CFDIRECTORY>. Project III: Adding Records to Your Database. Project IV: Editing an Existing Record in Your Database. Project V: Processing the Information. Adding a Record. <CFINSERT>. Updating a Record. <CFUPDATE>. Deleting a Record. Project VI: User Pages. Recap. Advanced Project.
<CFMAIL>. <CFFORM>. <CFINPUT>. <CFSWITCH> <CFCASE> and <CFDEFAULTCASE> Tags. Project I: Sign Up! <CFPOP>. Project II: Retrieving Your Email from a POP Server. Recap. Advanced Project.
PreserveSingleQuotes. <CFTABLE> and <CFCOL>. <CFTABLE>. <CFCOL>. Project I: Search Engines 'R' Us. Using Verity with ColdFusion. <CFCOLLECTION>. <CFINDEX>. <CFSELECT>. Project II: Collection Management. Project III: Searching with Verity. <CFSEARCH>. Recap. Advanced Project.
Security Basics. Project I: Protect Your Management Templates. Adding a Table to the shelleyCatalog Database. C Is for Cookie. Project II: Enhanced Functionality with <CFCOOKIE>. Recap. Advanced Project.
Introduction to Custom Tags. The Ins and Outs of Custom Tags. Where Can I Use Custom Tags? Project I: Counting Your Hits. SCRIPT_NAME Variable. Adding the Hits Table to the shelleyCatalog Database. Project II: Creating a Random Product Custom Tag. ListLen Function. ListAppend Function. ListGetAt Function. Other Functions Used in this Project. RandRange Function. Option 1-Code Every Page. Option 2-Make Use of the Developer's Friend, the Application.cfm File. Recap. Advanced Project.
What Is WAP and How Is It Useful? Limitations. MIME Types. Internet Information Server 4 and 5. Personal Web Site (PWS). <CFCONTENT>. Project I: WAP-Enabled Product List. Wireless Palm(tm) Series of Handhelds. Limitations. Palm Query Application. Project II: Palm(tm)-Enabled Product List. META Tags. Building and Installing the Palm(tm) Query Application. Recap. Advanced Project.
GET. POST. Buttons. Two Types of Buttons. Single-Line Text Box. Scrolling Text Box. Menus. Check Boxes. Radio Buttons. Putting It All Together.
In the beginning, creating websites using static pages was enough until people started to realize that updating content on their sites was a tedious chore. People also realized they had huge amounts of information they wanted to list on their constantly-changing websites, as well as in their databases.
Also needed was the ability to add logic to the websites, allowing the users to search through their products, buy their products online, or perform a number of other functions, turning it into one giant web application or a series of small ones. If a user comes to the website and performs a search, or navigates a certain way through the site, it would be nice to have pages dynamically built for them to accommodate where they are in the site. Suddenly several languages popped up that allowed the web developer to do all of these things and more. Each language had strengths and weaknesses such as learning curves and cost, but for the most part, many of these languages allowed you to create the same types of applications.
There are several types of languages used for web development with new ones popping up all the time. Here are a few examples of some of the better-known ones being used today:
ColdFusion | ASPActive Server Pages |
PHP | C++ |
Drumbeat | Lasso |
JSP-Java Server Pages (Servlets) | Perl |
PHP | Tango |
Tcl |
ColdFusion doesn't require a high level of knowledge in programming or server-side scripting to get started in developing some pretty powerful applications. Written in a way that resembles HTML syntax, ColdFusion Markup Language (CFML) consists of tags and attributes that transform a static web page into a truly dynamic and customizable experience for each and every user. CFML consists of a series of tags and formatting options that perform different functions:
<CFOUTPUT>Today's date is: #DateFormat(Now(), "DDDD, MMMM DD, YYYY")#</CFOUTPUT>
Today's date is: Saturday, November 25, 2000
The ColdFusion application server runs behind your existing web server and parses the .cfm file (.cfm is the extension all ColdFusion pages are saved with) that was passed and converts it into plain HTML, which is then presented to the viewer. The user never sees the actual CFML coding which took place.
With the introduction of ColdFusion 4.5, ColdFusion Application Server now runs on several operating systems including Windows 95/98/2000/NT, Solaris, and Linux. The recommended minimum requirements are:
ColdFusion 4.5 for Windows
ColdFusion 4.5 for Linux
ColdFusion 4.5 for Solaris
ColdFusion 4.5 for Windows
(Windows 2000 systems should have a minimum 96 MB of RAM)
ColdFusion 4.5 for Linux
There have been some problems using the tag <CFCONTENT> (introduced in chapter 9) with service pack 6 for NT 4.0. If you are currently using this you should upgrade to service pack 6a to fix this problem.
You can download a full-featured 30-day trial version of ColdFusion from Allaire's website (http://www.allaire.com
) to install on your machine. You can also grab a copy of another version of ColdFusion called ColdFusion Express, that you can run as long as you would like absolutely free. The catch, you ask? It doesn't have all the functionality, nor can it handle all the tags the full version offers.
As mentioned before, ColdFusion comes in three versions. Express is considered the development platform for many newcomers to ColdFusion.
This leaves Professional and Enterprise editions to tangle with. For all intents and purposes these versions are identical. They will process your ColdFusion code exactly the same. The benefit to having ColdFusion Enterprise is its ability to use and administer a clustered ColdFusion server environment to deal with failover (one system receiving too many requests and a second system (or more) assisting in handling the traffic). It also has native support for more database solutions such as Oracle and Sybase.
Yep, the other shoe has dropped. Express is a great product to get your feet wet with ColdFusion. Since its creation its intent was to feed you and allow you to learn ColdFusion for free and fall in love. Then once you're hooked, you'll have to pony up for the Enterprise or Professional versions of the product.
Rather than telling you what won't work, we'll list the tags that will work in ColdFusion Express. Most of these tags will be covered in this book along with some of the other full-version tags.
<CFABORT> |
<CFAPPLICATION> |
<CFBREAK> |
<CFCOOKIE> |
<CFIF> <CFELSEIF> <CFELSE> |
<CFINCLUDE> |
<CFINSERT> |
<CFLOCATION> |
<CFLOOP> |
<CFOUTPUT> |
<CFPARAM> |
<CFQUERY> |
<CFSET> |
<CFSETTING> |
<CFSWITCH> <CFCASE> <CFDEFAULTCASE> |
<CFUPDATE> |
Now if these aren't enough tags to work with, you have another option! Allaire provides free 30-day evaluations of most of their products, including ColdFusion. I would get very comfortable with the tags above while using Express and then give the evaluation full version a shot to do some test development. But make sure to do it quickly; 30 days really flies when you're having fun!
Although ColdFusion Studio is not required to create ColdFusion pages, it will make your life a little easier with all the wizards and built-in tools it has to offer, which will aid you in creating your pages quicker than if you were to do this in a regular text editor.
Cold Fusion Studio 4.5 has the following minimum requirements:
(Windows 2000 systems should have a minimum of 96 MB of RAM)
This book is written for anyone wanting to learn how to build dynamically driven database sites. You should already know how to use HTML and have an understanding of HTML forms. If you are unfamiliar with HTML forms or need a quick tutorial, check out Appendix A.
You should also have an understanding of Microsoft Access and the Structured Query Language (SQL). All of the Access databases we use in this book as well as the code and images will be on the companion website (www.phptr.com/essential/coldfusion/
). In chapter 1 we will also go over creating the shelleyCatalog Access database, which you will use in a few of these chapters.
There are several sites on the web that have communities of ColdFusion programmers who openly share their knowledge and expertise. One of the best places is the Allaire website itself where there is support for all of Allaire's products:
http://www.allaire.com/developer
You will also want to check out the Allaire Knowledge Base from time to time to find answers to frequently asked questions:
http://www.allaire.com/Support/KnowledgeBase/SearchForm.cfm
ColdFusion 4.5 server also comes with online documentation that was installed on your hard drive during the installation process. This can be found at:
http://127.0.0.1/CFDOCS/dochome.htm
127.0.0.1 is used throughout this book to refer to your local machine. This is the loopback IP address used for your local machine. The name localhost will work as well, or if your machine has been assigned its own IP address you can use it.
During installation you can choose to install the example applications that come with ColdFusion server. This is good for poking around and learning some already functional applications. Additional references are listed in Appendix B.
Ablecommerce | http://www.ablecommerce.com |
Autobytel | http://www.autobytel.com |
PolarisMan.com | http://www.polarisman.com |
OnVia | http://www.onvia.com |
E-ThePeople | http://www.e-thepeople.com |
Computer Acquisition Guide | http://computer.pwgsc.gc.ca |
Wireless Advisor | http://www.wirelessadvisor.com |
In order to demonstrate a wide range of functionality and practicality, a fictitious company "Shelley Biotechnologies" will be used to showcase its product line.
As we build this site we will teach you the components that go into creating different types of applications with ColdFusion.
The projects in each chapter are designed to build on the new functionality you are learning and apply it toward an application you would use in a real-life situation. At the end of each chapter you will be asked to complete a more advanced project based on what you have just done. The answer or possible solution is on the companion website.
While we teach you how to use ColdFusion using some of the most widely used tags and functions in the language, there are still plenty of other tags and functions that this book does not cover. These can be found in the documentation that comes with ColdFusion.
Chapter 4, Page 87
Project 4
The 'editItem' query in the itemManager.cfm page needs to be updated to:
SELECT * FROM products, Category WHERE (Category.categoryID = Products.category) AND (Products.sku = #URL.sku#)