MACROMEDIA COLDFUSION 5-DEVELOPING Manuel d'utilisateur Page 40

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 47
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 39
ColdFusion MX 7 Getting Started Experience Tutorial Page 40 of 47
Learning Point: Boolean values and cfif
Boolean variables store true (1) or false (0) values. Conditional statements must evaluate to true or false. Therefore, if a
variables stores a value of 1, ColdFusion will also interpret it as a true statement.
<font color="##FF0000">
<cfif artwork.isSold>
Sold!
</cfif>
</font>
Figure 57. Displaying the
word Sold! in the browser
The word Sold! only appears where needed.
Now imagine you created this page as static HTML; when you show it to your client, she says, “Very nice, but could
you please alphabetize the display by the art piece name?” This would take you a long time to modify in static HTML,
even using the easy Dreamweaver interface. With ColdFusion, this is a small change to the query.
23. Modify the SQL statement in the cfquery tag to include an ORDER BY clause, which tells the database to
alphabetize the results by the column specified, as the following code shows:
<cfquery name="artwork" datasource="cftutorial">
SELECT FIRSTNAME, LASTNAME, ARTNAME, DESCRIPTION, PRICE, LARGEIMAGE, ISSOLD, MEDIATYPE
FROM ARTISTS, ART, MEDIA
WHERE ARTISTS.ARTISTID = ART.ARTISTID
AND ART.MEDIAID = MEDIA.MEDIAID
ORDER BY ARTNAME
</cfquery>
24. Save and browse your page.
Vue de la page 39
1 2 ... 35 36 37 38 39 40 41 42 43 44 45 46 47

Commentaires sur ces manuels

Pas de commentaire