Opomba:
The user interface has been simplified in Dreamweaver CC and later. As a result, you may not find some of the options described in this article in Dreamweaver CC and later. For more information, see this article.
-
In the Name box, enter a name for the recordset.
A common practice is to add the prefix rs to recordset names to distinguish them from other object names in the code, for example: rsPressReleases.
Recordset names can only contain letters, numbers, and the underscore character (_). You cannot use special characters or spaces.
-
From the first pop‑up menu, select a column in the database table to compare against a test value you define.
From the second pop‑up menu, select a conditional expression to compare the selected value in each record against the test value.
From the third pop‑up menu, select Entered Value.
In the box, enter the test value.
If the specified value in a record meets your filtering condition, the record is included the recordset.
Define a recordset for ColdFusion document types as a source of dynamic content without you having to hand code SQL statements.
-
In the Name box, enter a name for the recordset.
A common practice is to add the prefix rs to recordset names to distinguish them from other object names in your code. For example: rsPressReleases
Recordset names can only contain letters, numbers, and the underscore character (_). You cannot use special characters or spaces.
-
If you’re defining a recordset for a ColdFusion component (that is, if a CFC file is currently open in Dreamweaver), select an existing CFC function from the Function pop‑up menu, or click the New Function button to create a new function.
Opomba:
The Function pop‑up menu is only available if a CFC file is the current document and you have access to a computer running ColdFusion MX 7 or better.
-
In the Username and Password boxes, enter the user name and password for the ColdFusion application server if required.
Data sources in ColdFusion may require a user name and password to access them. If you do not have the user name and password to access a data source in ColdFusion, contact your organization’s ColdFusion administrator.
-
From the first pop‑up menu, select a column in the database table to compare against a test value you define.
From the second pop‑up menu, select a conditional expression to compare the selected value in each record against the test value.
From the third pop‑up menu, select Entered Value.
In the box, enter the test value.
If the specified value in a record meets your filtering condition, the record is included in the recordset.
Write your own SQL statements by using the advanced Recordset dialog box, or create a SQL statement by using the graphical Database Items tree.
Define a recordset as a source of dynamic content by writing a custom SQL statement, or by creating a SQL statement using the graphical Database Items tree.
-
Enter a SQL statement in the SQL text area or use the graphical Database Items tree at the bottom of the dialog box to build a SQL statement from the chosen recordset.
Ensure the SQL text area is blank.
Expand the branches of the tree until you find the database object you need—a column in a table, for example, or a stored procedure in the database.
Select the database object and click one of the buttons on the right side of the tree.
For example, if you select a table column, the available buttons are SELECT, WHERE, and ORDER BY. Click one of the buttons to add the associated clause to your SQL statement.
You can also use a predefined SQL statement in a stored procedure by selecting the stored procedure from the Database Items tree and clicking the Procedure button. Dreamweaver automatically fills in the SQL and Variable areas.
-
If the SQL statement contains variables, define their values in the Variables area by clicking the Plus (+) button and entering the variable’s name, type (integer, text, date, or floating point number), default value (the value the variable should take if no run-time value is returned), and run-time value.
Opomba:
When using variables in a SQL statement in PHP, Dreamweaver automatically adds a leading dollar sign to the variable name, so you should omit the dollar sign (e.g., colname, instead of $colname).
If the SQL statement contains variables, make sure the Default Value column of the Variables box contains valid test values.
The run-time value is usually a URL or form parameter entered by a user in an HTML form field.
URL parameters in the Run-time Value column:
-
If the SQL statement contains variables, make sure the Default Value column of the Variables box contains valid test values before clicking Test.
If successful, a table appears displaying the data in your recordset. Each row contains a record and each column represents a field in that record. Click OK to clear the recordset.
Use the advanced Recordset dialog box to write custom SQL queries, or use the Database Items tree to author SQL queries using a point-and-click interface.
-
A common practice is to add the prefix rs to recordset names to distinguish them from other object names in your code. For example: rsPressReleases
Recordset names can only contain letters, numbers, and the underscore character (_). You cannot use special characters or spaces.
If you’re defining a recordset for a ColdFusion component (that is, if a CFC file is currently open in Dreamweaver), select an existing CFC function from the Function pop‑up menu, or click the New Function button to create a new function.
Opomba:
The Function pop‑up menu is only available if a CFC file is the current document and you have access to a computer running ColdFusion MX 7 or better.
-
Ensure the SQL text area is blank.
Expand the branches of the tree until you find the database object you need—for example, a column in a table.
Select the database object and click one of the buttons on the right side of the tree.
For example, if you select a table column, the available buttons are Select, Where, and Order By. Click one of the buttons to add the associated clause to your SQL statement.
If your SQL statement contains parameters, define their values in the Parameters area by clicking the Plus (+) button and entering the parameter’s name and default value (the value the parameter should take if no run-time value is returned).
If the SQL statement contains parameters, make sure the Default Value column of the Parameters box contains valid test values.
The Page Parameters allow you to provide default values for run-time value references in the SQL you write. For example, the following SQL statement selects an employee record based on the value of the employee’s ID. You can assign a default value to this parameter, ensuring that a run-time value is always returned. In this example, FormFieldName refers to a form field in which the user enters an employee ID:
SELECT * FROM Employees WHERE EmpID = + (Request.Form(#FormFieldName#))
-
If the SQL statement contains run-time references, make sure the Default Value column of the Page Parameters field contains valid test values before clicking Test.
If successful, a table appears displaying the data in your recordset. Each row contains a record and each column represents a field in that record. Click OK to clear the recordset.
Define parameters in a SQL statement; the default value is the value that the parameter should use if no run-time value is returned.
Define parameters in a SQL statement; the default value is the value that the parameter should use if no run-time value is returned.
Instead of manually typing SQL statements into the SQL box, you can use the Database Item’s point-and-click interface to create complex SQL queries. The Database Items tree lets you select database objects and link them using the SQL SELECT, WHERE, and ORDER BY clauses. After you create a SQL query, you can define any variables using the Variables area of the dialog box.
The next two examples describe two SQL statements and the steps for creating them using the advanced Recordset dialog box’s Database Items tree.
This example selects the entire contents of the Employees table. The SQL statement defining the query appears as follows:
SELECT * FROM Employees
The following example selects two rows from the Employees table, and selects the job type using a variable that you must define. The results are then ordered by employee name.
SELECT emplNo, emplName FROM Employees WHERE emplJob = 'varJob' ORDER BY emplName
URL parameters store retrieved information input by users. Before you begin, make sure you pass a form or URL parameter to the server. After you define the URL variable, you can use its value in the currently selected page.
Form parameters store retrieved information that is included in the HTTP request for a web page. If you create a form that uses the POST method, the data submitted by the form is passed to the server. Before you begin, make sure you pass a form parameter to the server. After you define the form parameter as a content source, you can use its value in your page.
You can use session variables to store and display information maintained for the duration of a user’s visit (or session). The server creates a different session object for each user and maintains it for a set period of time or until the object is explicitly terminated.
Before defining session variables for a page, you must create them in the source code. After you create a session variable in the web application’s source code, you can use Dreamweaver to retrieve its value and use it in a web page.
In ASP and ColdFusion, you can use application variables to store and display information that is maintained for the lifetime of the application and persists from user to user. After you define the application variable, you can use its value in a page.
Opomba:
There are no application variable objects in PHP.
When you define a recordset for a page in the Bindings panel, Dreamweaver enters the name of the ColdFusion data source in the cfquery tag on the page. For more flexibility, you can store a data source name in a variable and use the variable in the cfquery tag. Dreamweaver provides a visual method of specifying such a variable in your recordsets.
You define server variables as sources of dynamic content for use within a web application. Server variables vary from document type to document type and include form variables, URL variables, session variables, and application variables.
Server variables can be accessed by all clients that access the server, and by any applications running on the server. The variables persist until the server is stopped.
Variable |
Description |
---|---|
Server.ColdFusion.ProductName |
ColdFusion product name. |
Server.ColdFusion.ProductVersion |
ColdFusion version number. |
Server.ColdFusion.ProductLevel |
ColdFusion edition (Enterprise, Professional). |
Server.ColdFusion.SerialNumber |
Serial number of currently installed version of ColdFusion. |
Server.OS.Name |
Name of operating system running on the server (Windows XP, Windows 2000, Linux). |
Server.OS.AdditionalInformation |
Additional information about installed operating system (service packs, updates). |
Server.OS.Version |
Version of installed operating system. |
Server.OS.BuildNumber |
Build number of installed operating system. |
Local variables are variables created with the CFSET or CFPARAM tag within a ColdFusion page. The defined local variable appears in the Bindings panel.
You can define the following ASP server variables as sources of dynamic content: Request.Cookie, Request.QueryString, Request.Form, Request.ServerVariables, and Request.ClientCertificates.
-
In the Request Variable dialog box, select one of the following request collections from the Type pop‑up menu:
The QueryString collection
Retrieves information appended to the sending page’s URL, such as when the page has an HTML form using the GET method. The query string consists of one or more name-value pairs (for example, last=Smith, first=Winston) appended to the URL with a question mark (?). If the query string has more than one name-value pair, they are combined with ampersands (&).
The Form collection
Retrieves form information included in the body of the HTTP request by an HTML form using the POST method.
The ServerVariables collection
Retrieves the values of predefined environment variables. The collection has a long list of variables, including CONTENT_LENGTH (the length of content submitted in the HTTP request, which you can use to see if a form is empty), and HTTP_USER_AGENT (provides information about the user’s browser).
For example, Request.ServerVariables("HTTP_USER_AGENT") contains information about the submitting browser, such as Mozilla/4.07 [en] (WinNT; I), which denotes a Netscape Navigator 4.07 browser.
For a complete list of ASP server environment variables, see the online documentation installed with Microsoft Personal Web Server (PWS) or Internet Information Server (IIS).
-
For example, if you want to access the information in the Request.ServerVariables("HTTP_USER_AGENT") variable, enter the argument HTTP_USER_AGENT. If you want to access the information in the Request.Form("lastname") variable, enter the argument lastname.
The request variable appears in the Bindings panel.
Define server variables as a source of dynamic content for PHP pages. The PHP server variables appear in the Bindings panel.
Define a ColdFusion client variable as a source of dynamic content for the page. The newly defined ColdFusion client variables appear in the Bindings panel.
-
For example, to access the information in the Client.LastVisit ColdFusion variable, enter LastVisit.
Client variables are variables created in the code to associate data with a specific client. Client variables maintain the application’s state as the user moves from page to page within the application, as well as from session to session.
Client variables can be user-defined or built‑in. The following table lists the built‑in ColdFusion client variables:
Variable
Description
Client.CFID
An incremental ID for each client that connects to the server.
Client.CFTOKEN
A randomly generated number used to uniquely identify a particular client.
Client.URLToken
A combination of CFID and CFTOKEN to be passed between templates when cookies are not used.
Client.LastVisit
Records the timestamp of the last visit made by a client.
Client.HitCount
The number of page requests tied to a single client (tracked using CFID and CFTOKEN).
Client.TimeCreated
Records the timestamp when CFID and CFTOKEN were first created for a particular client.
Cookie variables are created in the code, and access information contained in cookies passed to the server by a browser. The defined cookie variable appears in the Bindings panel.
-
For example, if you want to access the information in the CGI.HTTP_REFERER variable, enter HTTP_REFERER.
The following table lists the most common ColdFusion CGI variables that are created on the server:
Variable
Description
SERVER_SOFTWARE
The name and version of the information server software answering the request (and running the gateway). Format: name/version.
SERVER_NAME
The server's hostname, DNS alias, or IP address as it appears in self-referencing URLs.
GATEWAY_INTERFACE
The revision of the CGI specification to which this server complies. Format: CGI/revision.
SERVER_PROTOCOL
The name and revision of the information protocol this request came in with. Format: protocol/revision.
SERVER_PORT
The port number to which the request was sent.
REQUEST_METHOD
The method with which the request was made. For HTTP, this is Get, Head, Post, and so on.
PATH_INFO
The extra path information, as given by the client. Scripts can be accessed by their virtual pathname, followed by extra information at the end of this path. The extra information is sent as PATH_INFO.
PATH_TRANSLATED
The server provides a translated version of PATH_INFO, which takes the path and does any virtual-to-physical mapping to it.
SCRIPT_NAME
A virtual path to the script being executed; used for self-referencing URLs.
QUERY_STRING
The query information that follows the question mark (?) in the URL that referenced this script.
REMOTE_HOST
The hostname making the request. If the server does not have this information, it sets REMOTE_ADDR and does not set REMOTE_HOST.
REMOTE_ADDR
The IP address of the remote host making the request.
AUTH_TYPE
If the server supports user authentication, and the script is protected, this is the protocol-specific authentication method used to validate the user.
REMOTE_USER AUTH_USER
If the server supports user authentication, and the script is protected, this is the user name they have authenticated as. (Also available as AUTH_USER.)
REMOTE_IDENT
If the HTTP server supports RFC 931 identification, this variable is set to the remote user name retrieved from the server. Use this variable for logging only.
CONTENT_TYPE
For queries that have attached information, such as HTTP POST and PUT, this is the content type of the data.
CONTENT_LENGTH
The length of the content as given by the client.
The following table lists the most common CGI variables created by the browser and passed to the server:
Variable
Description
HTTP_REFERER
The referring document. This is the document that linked to or submitted form data.
HTTP_USER_AGENT
The browser the client is currently using to send the request. Format: software/version library/version.
HTTP_IF_MODIFIED_SINCE
The last time the page was modified. This variable is sent at the discretion of the browser, usually in response to the server having sent the LAST_MODIFIED HTTP header. It can be used to take advantage of browser-side caching.
You can cache—or store—sources of dynamic content in a Design Note. This lets you work on a site even if you don’t have access to the database or application server storing the sources of dynamic content. Caching may also speed up development by eliminating repeated access across a network to the database and application server.
If you make changes to one of the content sources, you can refresh the cache by clicking the Refresh button (the circle-arrow icon) in the upper-right corner of the Bindings panel. (Expand the panel if you don’t see the button.)
You can change or delete any existing source of dynamic content—that is, any content source listed in the Bindings panel.
Changing or deleting a content source in the Bindings panel does not change or delete any instance of that content on the page. It merely changes or deletes it as a possible source of content for the page.