When I click an Edit link for a record, instead of displaying a form containing
existing data, I get 25 pages of the same record. I know my relationships in my
database are correct - they are all one-to-many. Where have I gone wrong? The main
file, Events contains the primary key ID and the other 6 tables each have a foreign
key also called ID.
Here is the cfquery and cfoutput code for my main file where the Edit link is located:
<!--- add query to select all events--->
<cfquery name="selectevent" datasource="Events">
SELECT *
FROM Events
WHERE ID = ID
</cfquery>
<!--- end query to select all events--->
<cfoutput query="selectevent">
<tr bgcolor="#iif(selectevent.currentrow MOD 2, DE('FFFFFF'), DE('E0E0E0'))#">
<td valign="top">
<a>#title#</a><br>
Updated on: <a>#Dateformat(updatedon, "mmmm dd, yyyy")#</a>
</td>
<td align="right" valign="top" width="200">
<a href="displayinterdesc.cfm?ID=#id#">Preview</a>
<a href="updateform.cfm?Id=#id#">Edit</a>
<a href="deleteform2.cfm?Id=#id#">Delete</a>
</td>
</tr>
</tr>
</cfoutput>
</table>
</body>
--------------------------------------------------------------------------------
Here is my cfquery and cfoutput and some of the form input code for my updateform file
.
<!--- query to get an event to update--->
<cfquery name="GetEventtoUpdate" datasource="Events"
cachedwithin="#CreateTimeSpan(1,0,0,0)#">
SELECT
Events.Title,
Events.InterDesc,
Events.IntraDesc,
Events.PrintDesc,
Events.PrintPub,
Events.InterPub,
Events.IntraPub,
Events.Inactive,
Events.Area,
Events.Location,
Events.Ticketed,
Events.Kid,
Events.Handicap,
Events.Updatedon,
Dates.BeginDate,
Dates.EndDate,
Times.EventTime,
Times.Comment,
Internet.BeginDate,
Internet.EndDate,
PPrint.BeginDate,
PPrint.EndDate,
Intranet.BeginDate,
Intranet.EndDate
FROM Events, Dates, Times, Internet, Intranet, PPrint
WHERE Events.ID = #URL.ID#
</cfquery>
<!--- end query--->
<cfoutput query="GetEventtoUpdate">
<form action="updateaction.cfm" method="post">
<input type="Hidden" name="ID" value="#ID#"><br>
<!--- start update form --->
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr><td></td>
<td align="right">Inactive? <input type="checkbox" name="Inactive"
value="#GetEventtoUpdate.Inactive#" unchecked></td>
</tr>
<tr>
<td width="100">Event Title:</td>
<td><input type="text" name="Title" value="#GetEventtoUpdate.Title#" size="67"
maxlength="255">
</td>
</tr>
<tr>
<td>Updated on: </td>
<td><input type="text" name="Updatedon"
value="#Dateformat(GetEventtoUpdate.updatedon, "mmmm dd, yyyy")#"></td>
</tr>
--------------------------------------------------------------------------------
Here is the code for the updateaction file
<cfquery name="UpdateEvent" datasource="Events">
UPDATE Events, Dates, times, Internet, Intranet, PPrint
SET
Events.Title = '#form.title#',
Events.InterDesc = '#form.InterDesc#',
Events.IntraDesc = '#form.IntraDesc#',
Events.PrintDesc = '#form.PrintDesc#',
Events.InterPub = '#form.InterPub#',
Events.IntraPub = '#form.IntraPub#',
Events.PrintPub = '#form.PrintPub#',
Events.Inactive = '#form.inactive#',
Events.Area = '#form.Area#',
Events.location = '#form.Location#',
Events.Ticketed = '#form.Ticketed#',
Events.Kid = '#form.Kid#',
Events.Handicap = '#form.Handicap#',
Events.Updatedon = '#form.Updatedon#',
Times.EventTime = '#form.Times.EventTime#',
Times.Comment = '#form.Comment#',
Dates.BeginDate = '#form.Dates.BeginDate#',
Dates.EndDate = '#form.Dates.EndDate#',
PPrint.BeginDate = '#form.PPrint.BeginDate#',
PPrint.EndDate = '#form.PPrint.EndDate#',
Internet.BeginDate = '#form.Internet.BeginDate#',
Internet.EndDate = '#form.Internet.EndDate#',
Intranet.BeginDate = '#form.Intranet.BeginDate#',
Intanet.EndDate = '#form.Intranet.EndDate#'
WHERE Events.ID = #URL.ID#
AND Dates.ID = #URL.ID#
AND Times.ID = #URL.ID#
AND Internet.ID = #URL.ID#
AND Intranet.ID = #URL.ID#
AND Print.ID = #URL.ID#
</cfquery>
Thanks in advance for your help.
Judy
______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists