
100
Chapter 6 Making Variables Dynamic
<cfif isDefined("Form.Contract")>
Employee.Contract = ‘Yes' AND
<cfelse>
Employee.Contract = 'No' AND
</cfif>
If the user selected the Contractor check
box, get data for the employees who are
contractors; otherwise, get data for
employees who are not contractors. The
isdefined
function test for the existence of
the Form.Contract variable is needed
because the variable only exists if they
select the Contractor box.
0=0
If none of the conditions are true, the 0=0
statement ensures that the WHERE clause
does not result in a SQL syntax error.
Instead, the SELECT statement returns the
entire table. Putting this statement at the
end of the WHERE clause improves
security by making it harder to attach extra
SQL statements in a dynamic variable, and
may affect the database’s optimization of
the SQL statement.
CFML Code
Description
Содержание COLDFUSION 5-DEVELOPING
Страница 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Страница 58: ...38 Chapter 3 Querying a Database ...
Страница 134: ...114 Chapter 7 Updating Your Database ...
Страница 210: ...190 Chapter 10 Reusing Code ...
Страница 232: ...212 Chapter 11 Preventing and Handling Errors ...
Страница 238: ...218 Chapter 12 Using the Application Framework ...
Страница 262: ...242 Chapter 12 Using the Application Framework ...
Страница 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Страница 320: ...300 Chapter 15 Indexing and Searching Data ...
Страница 336: ...316 Chapter 16 Sending and Receiving E mail ...
Страница 374: ...354 Chapter 18 Interacting with Remote Servers ...