On 2/14/01, Paul Ihrig penned:
>i am trying to understand conditional cfif staments to do this.
>
>IF EmployeeID = EmployeedID & AwardsID <> AwardsID then show a delete
>button.
>that seems simple to me.
>but in the master record every empID would Be equal to itself.
>so then i should see if its primamry key 'AwardsID' is equal to itself?
>IF not show the delete button'?
You could do:
cfquery name="getvotes"
select employeeid, awardsid
from awards
Then group the output:
<cfoutput query="getvotes" group="employeeid"><cfset votecount = 0>
<cfoutput><cfset votecount = votecount + 1></cfoutput>
<cfif votecount GT 1>
Show delete button
<input type = hidden name="employeeid" value="#employeeid">
<input type = hidden name=awardsid" value="#awardsid">
</cfif>
</cfoutput>
Then:
delete from awards
where employeeid = #form.employeeid# and awardsid <> #form.awardsid#
There are other ways of doing it where you could pass a list of
employeeids and awardsids and delete all except the main ones with
one click.
I think a better option would be on the vote page. Check for the
employeeid and if the recordcount is 1, then run an update query
instead of an insert query. That way they can change their vote. Or
if you don't want them to change their vote, then tell them Sorry,
you voted.
--
Bud Schneehagen - Tropical Web Creations
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists