Hi, i have a coldfusion code required for my personal project, but i need someone to check it if it works. my coldfusion server wont work, so here is what i have done, can someone please take a look and tell me if it doesnt work...thanks.
This is the first webpage (index.cfm) ..it takes several inputs and searches for them..
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FDF6E6" text="#000000">
<p class="Third">Search for instruments by supplying the following details.</p>
<form action="action.cfm" method="post" name="form">
<cfquery name="getStuff" datasource="MusicDB">
SELECT
Types.TypeName,
Types.TypeID
FROM Types
</cfquery>
<table width="600" height="160">
<tr>
<td height="40" width="300"> Instrument Type:</td>
<td width="300" height="40" bgcolor="#FDF6E6">
<select name="TypeName">
<option value="Any" selected>Any</option>
<cfoutput query="getStuff">
<option value="#TypeName#">#TypeNa
me#</optio
n>
</cfoutput>
</select>
</td>
</tr>
<tr>
<td height="40" width="300"> Condition:</td>
<td width="300" height="40" bgcolor="#FDF6E6">
<p><input type="radio" name="Condition" value="New">
New</p>
<p><input type="radio" name="Condition" value="Used">
Used</p>
</td>
</tr>
<tr>
<td height="40" width="300"> Lowest price: $</td>
<td width="300" height="40" bgcolor="#FDF6E6">
<p><input type="text" name="LowestPrice">
</p></td>
</tr>
<tr>
<td height="40" width="300"> Highest price: $</td>
<td width="300" height="40" bgcolor="#FDF6E6">
<p><input type="text" name="HighestPrice">
</p></td>
</tr>
</table>
<p>
<input type="submit" name="SubmitQuery" value="SubmitQuery">
<input type="reset" name="Reset" value="Reset"></p>
</form></html>
....this webpage first calls the MusicDB which has 2 tables (Instruments and Types)....this webpage calls action.cfm which looks like this:
<html>
<head>
</head>
<body bgcolor="#ffff99" text="#FF6600">
<cfif isNumeric (form.LowestPrice) is "Yes" and (form.LowestPrice less than 0)>
<cfelseif isNumeric (form.LowestPrice) is "Yes" and (form.HighestPrice less than 0)>
<cfelseif isNumeric (form.LowestPrice) is "Yes" and isNumeric (form.HighestPrice) is "Yes" and (form.LowestPrice greater than form.HighestPrice)>
<cfelse>
<cfquery name="getThings" datasource="MusicDB">
SELECT
Instruments.InstrumentID,
Instruments.InstrumentName
,
Types.TypeName,
Instruments.Condition,
Instruments.InstrumentPric
e
FROM Instruments, Types
WHERE (Instruments.TypeID=Types.
TypeID)
<cfif "#form.TypeName#" is not "Any">
AND (Types.TypeName="#form.Typ
eName#")
</cfif>
<cfif isDefined (form.Condition) is "Yes">
AND (Instruments.Condition="#f
orm.Condit
ion#")
</cfif>
<cfif isNumeric (form.LowestPrice) is "Yes">
AND (Instruments.InstrumentPri
ce >= #form.LowestPrice#)
</cfif>
<cfif isNumeric (form.HighestPrice) is "Yes">
AND (Instruments.InstrumentPri
ce <= #form.HighestPrice#)
</cfif>
</cfquery>
<h3><u>Search results are presented below.</u></h3><br><br>
<cfif getThings.recordCount is "0">
<p>Sorry, No record match your search criteria.<br>
Please search again.<br>
<cfelse>
<table width="600">
<tr>
<td height="40" width="150">Instrument ID</td>
<td height="40" width="150">Instrument Name</td>
<td height="40" width="100">Type</td>
<td height="40" width="100">Condition</td>
<td height="40" width="100">Price</td>
</tr>
<cfoutput query="getThings">
<tr align="left">
<td height="40" width="150">#InstrumentID#
</td>
<td height="40" width="150">#InstrumentNam
e#</td>
<td height="40" width="100">#TypeName#</td
>
<td height="40" width="100">#Condition#</t
d>
<td height="40" width="100">#dollarFormat(
Instrument
Price)#</t
d>
</tr>
</cfoutput>
</table>
</cfif>
</body>
</html>
now assuming all the connections to the database are working as well as the CSS scripts (if any), are there any errors anyone can see? thanks...your contribution is greatly appriciated
-Bob
Start Free Trial