RickyGtz
asked on
Only First Value from drop down menu is Inserted in database
My issue on this page is that I have A Team Number and several players, but only the first one grabs the value I sleect on the group and I prefer to insert on all of them each member.
<%@LANGUAGE="VBSCRIPT"%>
<% level="../../"%>
<!-- include file="../logincheck.asp"-->
<!--#include file="../include/intialize.inc"-->
<!--#include file="../../../Connections/sqlConn1.asp" -->
<%
T_Players = request.QueryString("TourID")
session ("S_TeamID") =request.QueryString("TourID")
Dim teamTourRS
Dim teamTourRS_cmd
Dim teamTourRS_numRows
Set teamTourRS_cmd = Server.CreateObject ("ADODB.Command")
teamTourRS_cmd.ActiveConnection = MM_sqlConn1_STRING
teamTourRS_cmd.CommandText = "SELECT * FROM dbo.tblTournament where TourID ="&T_Players&" "
teamTourRS_cmd.Prepared = true
Set teamTourRS = teamTourRS_cmd.Execute
teamTourRS_numRows = 0
' check for team or individual
tourFormat = teamTourRS("TourType").value
if tourFormat = "Individual" then
response.Redirect("ad_pairings.asp?TourID="&T_Players&"")
end if
%>
<%
Dim Recordset4
Dim Recordset4_cmd
Dim Recordset4_numRows
Set Recordset4_cmd = Server.CreateObject ("ADODB.Command")
Recordset4_cmd.ActiveConnection = MM_sqlConn1_STRING
Recordset4_cmd.CommandText = "SELECT TourName, TourNoplayers, AvailableSpots, MaxTeams,MinimumPlayers,MinimumTeams, TeamsPerHole, TeeTimes, TeeIntervals, MaxGroups, StartingHour, NumberofGroups, NumberofMatches, MatchesperGroup, TournamentFormat, GroupNumber, MatchNumber, MaxPlayers,HolesPlayed FROM dbo.tblTournament where TourID ="&T_Players&" "
Recordset4_cmd.Prepared = true
Set Recordset4 = Recordset4_cmd.Execute
Recordset4_numRows = 0
%>
<%
Dim matchTest
Dim matchTest_cmd
Dim matchTest_numRows
Set matchTest_cmd = Server.CreateObject ("ADODB.Command")
matchTest_cmd.ActiveConnection = MM_sqlConn1_STRING
matchTest_cmd.CommandText = "SELECT * from dbo.Players Where TeamLeader = 'True' and TourID ="&T_Players&" Order by TeamNumber"
matchTest_cmd.Prepared = true
Set matchTest = matchTest_cmd.Execute
matchTest_numRows = 0
%>
<%
Dim rstour2
Dim rstour2_cmd
Dim rstour2_numRows
Set rstour2_cmd = Server.CreateObject ("ADODB.Command")
rstour2_cmd.ActiveConnection = MM_sqlConn1_STRING
rstour2_cmd.CommandText = "SELECT TourID, TourName, TourDesc, TourNoplayers, TourStartdate, AvailableSpots, MaxTeams, CourseID, StartingTime,HolesPlayed, StartHole,Flight, TeamsPerHole, TeeTimes, TeeIntervals, MaxGroups, StartingHour, StartingMinute, NumberofGroups, NumberofMatches, MatchesperGroup, TournamentFormat, GroupNumber, MatchNumber, MaxPlayers FROM dbo.tblTournament where TourID ="&T_Players&" ORDER BY TourID ASC"
rstour2_cmd.Prepared = true
Set rstour2 = rstour2_cmd.Execute
rstour2_numRows = 0
%>
<%
Dim Recordset2
Dim Recordset2_cmd
Dim Recordset2_numRows
Set Recordset2_cmd = Server.CreateObject ("ADODB.Command")
Recordset2_cmd.ActiveConnection = MM_sqlConn1_STRING
Recordset2_cmd.CommandText = "SELECT Flight1,Flight2,Flight3,Flight4,Flight5,Flight6,StartingTime, StartingHour, StartingMinute FROM dbo.tblTournament where TourID ="&T_Players&""
Recordset2_cmd.Prepared = true
Set Recordset2 = Recordset2_cmd.Execute
Recordset2_numRows = 0
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_sqlConn1_STRING
Recordset1_cmd.CommandText = "SELECT Count(StartingTime) as Cnt, StartingTime FROM dbo.tblTournament where TourID ="&T_Players&" Group By StartingTime "
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
If Recordset1.EOF then
'no record , need handle it.
end if
totalplayer = Recordset1("Cnt")
%>
<%
Dim rsMatches
Dim rsMatches_cmd
Dim rsMatches_numRows
Set rsMatches_cmd = Server.CreateObject ("ADODB.Command")
rsMatches_cmd.ActiveConnection = MM_sqlConn1_STRING
rsMatches_cmd.CommandText = "SELECT * FROM dbo.Players where TourID ="&T_Players&" and TeamLeader = 'True' Order by TeamNumber "
rsMatches_cmd.Prepared = true
Set rsMatches = rsMatches_cmd.Execute
rsMatches_numRows = 0
%>
<%
Dim rsTeamPlayers
Dim rsTeamPlayers_cmd
Dim rsTeamPlayers_numRows
Set rsTeamPlayers_cmd = Server.CreateObject ("ADODB.Command")
rsTeamPlayers_cmd.ActiveConnection = MM_sqlConn1_STRING
rsTeamPlayers_cmd.CommandText = "SELECT * FROM dbo.Players where TourID ="&T_Players&" order by TeamNumber, AdjustedTeamHandicap,TIID asc,TeamLeader desc "
rsTeamPlayers_cmd.Prepared = true
Set rsTeamPlayers = rsTeamPlayers_cmd.Execute
rsTeamPlayers_numRows = 0
%>
<html>
<head>
<title><%=PageTitle%></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo3 {
font-size: 18px;
color: #000000;
}
-->
</style>
<script language=javascript>
function checkDrop() {
if (document.form1.drop1.value == "Colors") document.getElementById("Colors").style.display='';
else document.getElementById("Colors").style.display='none';
}
function hideColors() {
document.getElementById("Colors").style.display="none";
}
</script>
<script type="text/javascript">
function showhide(){
var a=document.getElementById('test')
if(a.style.display==''){
a.style.display='none';
}else{
a.style.display='';
}
}
</script>
<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function YY_checkform() { //v4.66
//copyright (c)1998,2002 Yaromat.com
var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
for (var i=1; i<args.length;i=i+4){
if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
myV=myObj.value;
if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
if (myReq&&myObj.value.length==0){addErr=true}
if ((myV.length>0)&&(args[i+2]==1)){ //fromto
var myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
} else if ((myV.length>0)&&(args[i+2]==2)){
var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
} else if ((myV.length>0)&&(args[i+2]==3)){ // date
var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
if(myAt){
var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
var myDate=new Date(myY,myM,myD);
if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
}else{addErr=true}
} else if ((myV.length>0)&&(args[i+2]==4)){ // time
var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
} else if (myV.length>0&&args[i+2]==5){ // check this 2
var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
if(!myObj1.checked){addErr=true}
} else if (myV.length>0&&args[i+2]==6){ // the same
var myObj1 = MM_findObj(args[i+1]);
if(myV!=myObj1.value){addErr=true}
}
} else
if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
if (args[i+2]==2){
var myDot=false;
for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
if(!myDot){myErr+='* ' +args[i+3]+'\n'}
}
} else if (myObj.type=='checkbox'){
if(args[i+2]==1&&myObj.checked==false){addErr=true}
if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
} else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
}else if (myObj.type=='textarea'){
if(myV.length<args[i+1]){addErr=true}
}
if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
}
if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}
document.MM_returnValue = (myErr=='');
}
//-->
</script>
<link href="../../../includes/skins/formal/tng.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/formal/wdg.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/kollection/tng.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/kollection/wdg.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/kollection/cal.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/arktic/tng.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/arktic/wdg.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/arktic/nav.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo7 {color: #000102}
.style1 {
text-align: center;
}
.style2 {
text-align: right;
}
-->
</style>
</head>
<script language=Javascript>
function del_member(ssn)
{
delconfirm = confirm("Are you Sure To delete this Record");
if (delconfirm)
window.location = "ad_Tourmemlisting.asp?<%=request.ServerVariables("QUERY_STRING")%>&action=delete&ID="+ssn;
}
</script>
<script type="text/javascript">
function showhide(){
var a=document.getElementById('form2')
if(a.style.display==''){
a.style.display='none';
}else{
a.style.display='';
}
}
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center"></div>
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" ><!--#include file="../include/course_header.asp"--></td>
</tr>
</table>
<table width="600" align="center">
<tr>
<td height="380" width="73%" align="top" bgcolor="#ffffff">
<div align="center">
<% if (session("adminname")<>"") then
%>
<!--#include file="../include/loggedmenu.asp"-->
<%
end if
%>
<table width="773" border="1" align="center" class="tablesubheader">
<tr>
<td><strong>:: <a href="<%=level%>admin/Tournaments/prt_tourlist.asp" class="loggedmenulink"> Print Reports</a> :: :: <a href="<%=level%>admin/Members/ad_matchs.asp" class="loggedmenulink"> Set Pairings</a> :: <a href="<%=level%>admin/Members/pairings.asp?TourID=<%=teamTourRS("TourID")%>" class="loggedmenulink">:: View Pairings :: :: Edit Tournaments</a> :: </strong></td>
</tr>
</table>
<br>
<table width="69%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" class="errtext"><div align="left" class="KT_tngtable">
<p class="Estilo3">Tournament Matchups</p>
<table width="401" height="60" border="2">
<tr>
<td width="170"><b>Tournament :</b> <%=rstour2("TourName") %></td>
<% TeamsRegistered = rsTour2("MaxTeams") - rsTour2("AvailableSpots") %>
<td width="148"><b>Teams Limit :</b> <%=TeamsRegistered %> </td>
</tr>
<tr>
<td><b>Tee Times: </b> <%=rsTour2("TeeTimes")%> </td>
<td><b>Spots Left :<%=(Recordset4.Fields.Item("AvailableSpots").Value)%></b></td>
</tr>
</table>
<%
' Check for minimum # players or Teams in so The Pairings can be formed correctly...
PlayersIn = Recordset4("MaxTeams") - Recordset4("AvailableSpots")
'response.write " PLayer IN : " & PlayersIn
If Recordset4("MinimumTeams").value > PlayersIn Then %>
<table width="600" border="2">
<tr>
<td class="errtext">Warning : The Minimum # of Teams Has not been Met, Please wait Until Number is reached. </td>
</tr>
</table>
<% end If %>
<p class="textbold"><u>Please Set the Pairings for Each Team</u></p>
<span class="Estilo7">
<%
if rsTeamPlayers.bof then
%>
</span>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"><tr>
<td align="center" class="errtext">Not User Have Confirmed thier Registration </td>
</tr></table>
<%
response.End()
end if %>
<form name="form1" method="post" action="">
<table height="80" border="2" align="center" style="width: 753px">
<tr bgcolor="#CCCCCC">
<td class="style1" style="width: 141px"><div align="left">Team Name </div></td>
<td class="style1"><div align="left">Member Name</div></td>
<td class="style1"><div align="left">Handicap</div></td>
<td class="style1"><div align="left">Team Handicap</div></td>
<td class="style1"><div align="left">Group #<span class="lcontainer" style="width: 51px"></span></div></td>
<td width="79" class="style1"><div align="left">Flight</div></td>
<td class="style1" style="width: 108px"><div align="left">Starting Hole</div></td>
<td width="42" style="width: 19px" class="style1"><div align="left">Check</div></td>
</tr>
<div align="center">
<%
if not rsTour2.EOF then
nct = rsTour2("MaxTeams")
else
nct= 1
End if
rsTeamPlayers.movefirst
For p=1 to nct
if not rsTeamPlayers.eof then
ID=rsTeamPlayers("ID")
TIID=rsTeamPlayers("TIID")
username=rsTeamPlayers("SSN")
teamname=rsTeamPlayers("teamname")
teamleader=rsTeamPlayers("TeamLeader")
firstname=rsTeamPlayers("firstname")
lastname=rsTeamPlayers("lastname")
regdate=rsTeamPlayers("regdate")
GHIN_No=rsTeamPlayers("GHIN")
mstatus=rsTeamPlayers("status")
courseid=rsTeamPlayers("CourseID")
handicap= rsTeamPlayers("Handicap")
TeamNumberPlayers= rsTeamPlayers("TeamTournamentMembers")
paidTourFee = rsTeamPlayers("PaidFee")
TeamNumber = rsTeamPlayers("TeamNumber")
AvgHandicap = rsTeamPlayers("AdjustedTeamHandicap")
PlayerTourID = rsTeamPlayers("TourID")
' From Players Table Displaying ON Report
'TourFlight = rsTour2("Flight")
StartingTime =rsTour2("StartingTime")
FirstHole = rsTour2("StartHole")
if (Request.Form("Save")<>"" ) Then
txtGroupSelected= request.form("GroupSelect"&p)
arrGroup = split(txtGroupSelected, "|") 'split the select value on | delimiter, and create array in arrGroup
if ubound(arrGroup) > 0 then
txtGroupSelected = arrGroup(0) 'assign original group value from =i
txtx3Value = arrGroup(1) 'assign values you showed in x3 e.g. Group # 1
txtTeeTime = arrGroup(2) 'assign values you showed in x2
end if
MatchSelect = Request.Form("MatchSelect"&p)
txtstarthole = Request.Form("StartHole"&p)
txtflightSelect = Request.Form("flightSelect"&p)
' To set the Matchup ID go incremented
set rs_val = Server.Createobject("ADODB.Recordset")
ccnt=0
c=0
sql_res_val="select max(MatchID) from Matchups" 'Team ID
rs_val.open sql_res_val,conSQL
if rs_val(0)<>"" Then
MatchID = rs_val(0)+1
Else
MatchID = "0001"
End if
consql.execute("Set IDENTITY_INSERT Matchups ON Insert into Matchups (MatchID,TIID,TeamNumber,TeamName,PlayerFirstName,PlayerLastName,AdjustedTeamHandicap,TourID,GroupNumber,TournamentMatch,TeeOffTime,StartingHole,Flight,GroupID) values ('"&MatchID&"','"&TIID&"','"&TeamNumber&"','"&TeamName&"','"&firstname&"','"&lastname&"','"&AvgHandicap&"','"&PlayerTourID&"','"&txtgroupSelected&"','"&MatchSelect&"','"&txtTeeTime&"','"&txtStartHole&"','"&txtflightSelect&"','"&GroupID&"')")
If Err.Number <> 0 Then
Response.Write "Error: " & Err.Description
response.end
end if
url="successful.asp"
end if
%>
<%
'----------------------------------- Code Included Here ----------------'
if Last_TIID <> TIID then
' add things here on the blank row..
%>
</div>
<tr><td colspan="15" bgcolor="#000000" height="2px"></td></tr><%
End If
'-----------------------------------------------------------------------'
%>
<tr>
<td class="lcontainer" style="width: 141px"><span class="text2">
<% if ( rsTeamPlayers("teamleader")= true ) then %>
<%=teamname%><% end if %> </a></span></td>
<td width="82" class="lcontainer" style="width: 91px"><a href="memview.asp?ID=<%=ID%>" >
<%=firstname%>,<%=lastname%> </a></td>
<td width="53" class="lcontainer" style="width: 51px"><span class="text2"><%=handicap%></span></td>
<td width="86" class="lcontainer" style="width: 51px"><span class="text2"><% if ( rsTeamPlayers("teamleader")= true ) then %> <%=AvgHandicap%><%end if%></span></td>
<td width="53" class="lcontainer" style="width: 51px">
<% if ( rsTeamPlayers("teamleader")= true ) then %>
<span class="lcontainer" style="width: 51px">
<select name="GroupSelect<%=p%>" id="GroupSelect<%=p%>" >
<%
Dim mins, hrs
While (NOT Recordset1.EOF)
for i=1 to CInt(rsTour2("TeeTimes").Value)
'x2 = x + (rsTour2("TeeIntervals").Value * i)
x2 = DateAdd("n", rsTour2("TeeIntervals").Value * i, x)
' Extract minutes from "x" and add interval
mins = DatePart("n", x) + (rsTour2("TeeIntervals").Value * i)
hrs = Recordset2.Fields.Item("StartingHour").Value
' Determine hour increment, cycling on 60 minutes
If (mins >= 60) Then
hrs = hrs + (mins \ 60) ' Increment the hour for every 60 cycle
mins = mins Mod 60 ' Cycle minutes every 60
End If
x2 = hrs & ":" & Right("0" & mins, 2)
x3 = "Group #" &i
%>
<option value="<%=i%>|<%=x3%>|<%=x2%>"><%=x3%> : <%=x2%></option>
<%
Next
if not recordset1.eof then
Recordset1.MoveNext()
end if
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
</span></td>
<% end if %>
<td>
<% if ( rsTeamPlayers("teamleader")= true ) then
'' SUBSTITUE MATCH NUMBER FOR FLIGHT NAME!!!!
%>
<select name="flightSelect<%=p%>" id="flightSelect<%=p%>">
<option value selected="0">Select One</option>
<%
While (NOT Recordset2.EOF)
if Recordset2.Fields.Item("Flight1") <> "" then
%>
<option value="<%=(Recordset2.Fields.Item("Flight1").Value)%>"><%=(Recordset2.Fields.Item("Flight1").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight1") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight2").Value)%>"><%=(Recordset2.Fields.Item("Flight2").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight3") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight3").Value)%>"><%=(Recordset2.Fields.Item("Flight3").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight4") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight4").Value)%>"><%=(Recordset2.Fields.Item("Flight4").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight5") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight5").Value)%>"><%=(Recordset2.Fields.Item("Flight5").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight6") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight6").Value)%>"><%=(Recordset2.Fields.Item("Flight6").Value)%></option>
<% end if%>
<%
Recordset2.MoveNext()
Wend
If (Recordset2.CursorType > 0) Then
Recordset2.MoveFirst
Else
Recordset2.Requery
End If
%>
</select>
</td>
<% end if %>
<td style="width: 108px">
<% if ( rsTeamPlayers("teamleader")= true ) then %>
<select name="StartHole<%=p%>" id="StartHole">
<option value="NA">Select One</option>
<option value="1">Hole #1</option>
<option value="2">Hole #2</option>
<option value="3">Hole #3</option>
<option>Hole #4</option>
<option>Hole #5</option>
<option>Hole #6</option>
<option>Hole #7</option>
<option>Hole #8</option>
<option>Hole #9</option>
<option>Hole #10</option>
<option>Hole #11</option>
<option>Hole #12</option>
<option>Hole #13</option>
<option>Hole #14</option>
<option>Hole #15</option>
<option>Hole #16</option>
<option>Hole #17</option>
<option>Hole #18</option>
</select></td>
<% end if %> <% if ( rsTeamPlayers("teamleader")= true ) then %>
<td style="width: 19px"><label>
<input type="checkbox" name="checkmatch<%=p%>" id="checkmatch<%=p%>">
</label></td>
<% end if %>
</tr>
<%
i = i + 1
'------------- Code included here -------------'
Last_TIID = TIID
'----------------------------------------------'
rsTeamPlayers.movenext
end if
next
Recordset2.Close()
Set Recordset2 = Nothing
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
teamTourRS.Close()
Set teamTourRS = Nothing
%>
<%
rsMatches.Close()
Set rsMatches = Nothing
%>
<%
rsTeamPlayers.Close()
Set rsTeamPlayers = Nothing
If "" <> Trim(Request.Form("Save")) AND "" <> Trim(url) Then
Response.Redirect(url)
Response.End
End If
%> </table>
<div class="style2"><span style="width: 19px">
<br>
<input name="Save" type="submit" id="Save" onClick="YY_checkform('form1','checkmatch<%=p%>','#q','1','Field \'checkmatch<%=p%>\' is not valid.','StartHole','#q','1','Field \'StartHole\' is not valid.');return document.MM_returnValue" value="Save Changes">
</span></div>
<p align="right"> </p>
</form>
</div></td>
<tr>
<td><!--#include file="../include/footer.asp"--></td>
</tr>
</table>
</body>
</html>
<%
Recordset4.Close()
Set Recordset4 = Nothing
%>
Sorry forgot something
UPDATE TableName SET TableName.FieldName = 1;
WHERE (((TableName.GroupID)=1));
UPDATE TableName SET TableName.FieldName = 1;
WHERE (((TableName.GroupID)=1));
ASKER
Opps I forgot about that Flight2 mistake.
Yes Indeed, I want to insert the value I choose on Group, on all the team members not only one of them. Please refer this page that shows incorrectly the outcome. But dont know exaclty what to change to make this right.
http://www.playerscores.net/admin/members/pairings.asp?TourID=37
Yes Indeed, I want to insert the value I choose on Group, on all the team members not only one of them. Please refer this page that shows incorrectly the outcome. But dont know exaclty what to change to make this right.
http://www.playerscores.net/admin/members/pairings.asp?TourID=37
Under Group all i see if 0,0,0,0,0,2,2
Anyway.
If you wanted to update all the records in a given field, then you can use the example that I supplied
And give it a shot, and see if it will work.
I would have to see your actual update statement in order to assist further.
Anyway.
If you wanted to update all the records in a given field, then you can use the example that I supplied
And give it a shot, and see if it will work.
I would have to see your actual update statement in order to assist further.
ASKER
yes 0,0,0,0,0,2,2 should be all 2s, but it only takes '2' on the first member...
I am going to make up a demo, give me a few minutes.
ASKER
consql.execute("Set IDENTITY_INSERT Matchups ON Insert into Matchups (MatchID,TIID,TeamNumber,T eamName,Pl ayerFirstN ame,Player LastName,A djustedTea mHandicap, TourID,Gro upNumber,T ournamentM atch,TeeOf fTime,Star tingHole,F light,Grou pID) values ('"&MatchID&"','"&TIID&"', '"&TeamNum ber&"','"& TeamName&" ','"&first name&"','" &lastname& "','"&AvgH andicap&"' ,'"&Player TourID&"', '"&txtgrou pSelected& "','"&Matc hSelect&"' ,'"&txtTee Time&"','" &txtStartH ole&"','"& txtflightS elect&"',' "&GroupID& "')")
consql.execute("Set IDENTITY_INSERT Matchups ON UPDATE Matchups SET GroupNumber = '"&txtgroupSelected&"' WHERE GroupNumber = '' ")
consql.execute("Set IDENTITY_INSERT Matchups ON UPDATE Matchups SET GroupNumber = '"&txtgroupSelected&"' WHERE GroupNumber = '' ")
ASKER
look I added the following update, is that what you suggested,, but I am kinda lost how to update in each player ..
ASKER
consql.execute("Set IDENTITY_INSERT Matchups ON UPDATE Matchups SET GroupNumber = '"&txtgroupSelected&"' WHERE TIID = '"&TIID&"' ")
that updates, but Now I get all zeros...
So the looping part is the problem
Set IDENTITY_INSERT
I am not sure what that is? I checked and it is SQL Server.
Are you using SQL Server?
Since I have your table layout, I will duplicate it and see what I can do for you.
Is any of the numbers [AutoNumber] Field?
I am not sure what that is? I checked and it is SQL Server.
Are you using SQL Server?
Since I have your table layout, I will duplicate it and see what I can do for you.
Is any of the numbers [AutoNumber] Field?
ASKER
yes is Sql Server 2005, I think this update does work, but the loop is not pikcing up the Right Number.
ASKER
ok look both pages:
If I display the dropdown list for each members of a team value are inserted right. So, what is the way to make that only drop down value selected insert in all members>? if there is way
If I display the dropdown list for each members of a team value are inserted right. So, what is the way to make that only drop down value selected insert in all members>? if there is way
OK.
The only thing that I will be able to supply for you is the code to update a single Row.
(If I do not fall asleep first,,, 2:21amEST)
The only thing that I will be able to supply for you is the code to update a single Row.
(If I do not fall asleep first,,, 2:21amEST)
ASKER
ok ill give it a try . thanks
Hope this is what you are needing. I have to get to sleep.
http://192.168.2.9/Test/EE/Q_24124877/Select.asp?id=1
http://192.168.2.9/Test/EE/Q_24124877/Q_24124877.zip
Have a good one Ricky
Wayne
http://192.168.2.9/Test/EE/Q_24124877/Select.asp?id=1
http://192.168.2.9/Test/EE/Q_24124877/Q_24124877.zip
Have a good one Ricky
Wayne
Ricky I am so, so , so very sorry for that last post.
I did not realize that I gave you the links to my personal network... So very sorry.
I think this is what you are after.
http://www.pcitdad.com/Test/EE/Q_24124877/Select.asp?id=1
http://www.pcitdad.com/Test/EE/Q_24124877/Q_24124877.zip
Have a good one.
Wayne
I did not realize that I gave you the links to my personal network... So very sorry.
I think this is what you are after.
http://www.pcitdad.com/Test/EE/Q_24124877/Select.asp?id=1
http://www.pcitdad.com/Test/EE/Q_24124877/Q_24124877.zip
Have a good one.
Wayne
ASKER
Not really. What I did was to leave a drop down for each team to avoid this . If I display the dropdown list for each members of a team value are inserted right.
ASKER
If you could suggest how to avoid having one on each team, instead on each player, or if not is fine i will leave like that.
<%@LANGUAGE="VBSCRIPT"%>
<% level="../../"%>
<!-- include file="../logincheck.asp"-->
<!--#include file="../include/intialize.inc"-->
<!--#include file="../../../Connections/sqlConn1.asp" -->
<%
T_Players = request.QueryString("TourID")
session ("S_TeamID") =request.QueryString("TourID")
Dim teamTourRS
Dim teamTourRS_cmd
Dim teamTourRS_numRows
Set teamTourRS_cmd = Server.CreateObject ("ADODB.Command")
teamTourRS_cmd.ActiveConnection = MM_sqlConn1_STRING
teamTourRS_cmd.CommandText = "SELECT * FROM dbo.tblTournament where TourID ="&T_Players&" "
teamTourRS_cmd.Prepared = true
Set teamTourRS = teamTourRS_cmd.Execute
teamTourRS_numRows = 0
' check for team or individual
tourFormat = teamTourRS("TourType").value
if tourFormat = "Individual" then
response.Redirect("ad_pairings.asp?TourID="&T_Players&"")
end if
%>
<%
Dim Recordset4
Dim Recordset4_cmd
Dim Recordset4_numRows
Set Recordset4_cmd = Server.CreateObject ("ADODB.Command")
Recordset4_cmd.ActiveConnection = MM_sqlConn1_STRING
Recordset4_cmd.CommandText = "SELECT TourName, TourNoplayers, AvailableSpots, MaxTeams,MinimumPlayers,MinimumTeams, TeamsPerHole, TeeTimes, TeeIntervals, MaxGroups, StartingHour, NumberofGroups, NumberofMatches, MatchesperGroup, TournamentFormat, GroupNumber, MatchNumber, MaxPlayers,HolesPlayed FROM dbo.tblTournament where TourID ="&T_Players&" "
Recordset4_cmd.Prepared = true
Set Recordset4 = Recordset4_cmd.Execute
Recordset4_numRows = 0
%>
<%
Dim matchTest
Dim matchTest_cmd
Dim matchTest_numRows
Set matchTest_cmd = Server.CreateObject ("ADODB.Command")
matchTest_cmd.ActiveConnection = MM_sqlConn1_STRING
matchTest_cmd.CommandText = "SELECT * from dbo.Players Where TeamLeader = 'True' and TourID ="&T_Players&" Order by TeamNumber"
matchTest_cmd.Prepared = true
Set matchTest = matchTest_cmd.Execute
matchTest_numRows = 0
%>
<%
Dim rstour2
Dim rstour2_cmd
Dim rstour2_numRows
Set rstour2_cmd = Server.CreateObject ("ADODB.Command")
rstour2_cmd.ActiveConnection = MM_sqlConn1_STRING
rstour2_cmd.CommandText = "SELECT TourID, TourName, TourDesc, TourNoplayers, TourStartdate, AvailableSpots, MaxTeams, CourseID, StartingTime,HolesPlayed, StartHole,Flight, TeamsPerHole, TeeTimes, TeeIntervals, MaxGroups, StartingHour, StartingMinute, NumberofGroups, NumberofMatches, MatchesperGroup, TournamentFormat, GroupNumber, MatchNumber, MaxPlayers FROM dbo.tblTournament where TourID ="&T_Players&" ORDER BY TourID ASC"
rstour2_cmd.Prepared = true
Set rstour2 = rstour2_cmd.Execute
rstour2_numRows = 0
%>
<%
Dim Recordset2
Dim Recordset2_cmd
Dim Recordset2_numRows
Set Recordset2_cmd = Server.CreateObject ("ADODB.Command")
Recordset2_cmd.ActiveConnection = MM_sqlConn1_STRING
Recordset2_cmd.CommandText = "SELECT Flight1,Flight2,Flight3,Flight4,Flight5,Flight6,StartingTime, StartingHour, StartingMinute FROM dbo.tblTournament where TourID ="&T_Players&""
Recordset2_cmd.Prepared = true
Set Recordset2 = Recordset2_cmd.Execute
Recordset2_numRows = 0
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_sqlConn1_STRING
Recordset1_cmd.CommandText = "SELECT Count(StartingTime) as Cnt, StartingTime FROM dbo.tblTournament where TourID ="&T_Players&" Group By StartingTime "
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
If Recordset1.EOF then
'no record , need handle it.
end if
totalplayer = Recordset1("Cnt")
%>
<%
Dim rsMatches
Dim rsMatches_cmd
Dim rsMatches_numRows
Set rsMatches_cmd = Server.CreateObject ("ADODB.Command")
rsMatches_cmd.ActiveConnection = MM_sqlConn1_STRING
rsMatches_cmd.CommandText = "SELECT * FROM dbo.Players where TourID ="&T_Players&" and TeamLeader = 'True' Order by TeamNumber "
rsMatches_cmd.Prepared = true
Set rsMatches = rsMatches_cmd.Execute
rsMatches_numRows = 0
%>
<%
Dim rsTeamPlayers
Dim rsTeamPlayers_cmd
Dim rsTeamPlayers_numRows
Set rsTeamPlayers_cmd = Server.CreateObject ("ADODB.Command")
rsTeamPlayers_cmd.ActiveConnection = MM_sqlConn1_STRING
rsTeamPlayers_cmd.CommandText = "SELECT * FROM dbo.Players where TourID ="&T_Players&" order by TeamNumber, AdjustedTeamHandicap,TIID asc,TeamLeader desc "
rsTeamPlayers_cmd.Prepared = true
Set rsTeamPlayers = rsTeamPlayers_cmd.Execute
rsTeamPlayers_numRows = 0
%>
<html>
<head>
<title><%=PageTitle%></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo3 {
font-size: 18px;
color: #000000;
}
-->
</style>
<script language=javascript>
function checkDrop() {
if (document.form1.drop1.value == "Colors") document.getElementById("Colors").style.display='';
else document.getElementById("Colors").style.display='none';
}
function hideColors() {
document.getElementById("Colors").style.display="none";
}
</script>
<script type="text/javascript">
function showhide(){
var a=document.getElementById('test')
if(a.style.display==''){
a.style.display='none';
}else{
a.style.display='';
}
}
</script>
<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function YY_checkform() { //v4.66
//copyright (c)1998,2002 Yaromat.com
var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
for (var i=1; i<args.length;i=i+4){
if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
myV=myObj.value;
if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
if (myReq&&myObj.value.length==0){addErr=true}
if ((myV.length>0)&&(args[i+2]==1)){ //fromto
var myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
} else if ((myV.length>0)&&(args[i+2]==2)){
var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
} else if ((myV.length>0)&&(args[i+2]==3)){ // date
var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
if(myAt){
var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
var myDate=new Date(myY,myM,myD);
if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
}else{addErr=true}
} else if ((myV.length>0)&&(args[i+2]==4)){ // time
var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
} else if (myV.length>0&&args[i+2]==5){ // check this 2
var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
if(!myObj1.checked){addErr=true}
} else if (myV.length>0&&args[i+2]==6){ // the same
var myObj1 = MM_findObj(args[i+1]);
if(myV!=myObj1.value){addErr=true}
}
} else
if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
if (args[i+2]==2){
var myDot=false;
for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
if(!myDot){myErr+='* ' +args[i+3]+'\n'}
}
} else if (myObj.type=='checkbox'){
if(args[i+2]==1&&myObj.checked==false){addErr=true}
if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
} else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
}else if (myObj.type=='textarea'){
if(myV.length<args[i+1]){addErr=true}
}
if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
}
if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}
document.MM_returnValue = (myErr=='');
}
//-->
</script>
<link href="../../../includes/skins/formal/tng.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/formal/wdg.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/kollection/tng.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/kollection/wdg.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/kollection/cal.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/arktic/tng.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/arktic/wdg.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/arktic/nav.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo7 {color: #000102}
.style1 {
text-align: center;
}
.style2 {
text-align: right;
}
-->
</style>
</head>
<script language=Javascript>
function del_member(ssn)
{
delconfirm = confirm("Are you Sure To delete this Record");
if (delconfirm)
window.location = "ad_Tourmemlisting.asp?<%=request.ServerVariables("QUERY_STRING")%>&action=delete&ID="+ssn;
}
</script>
<script type="text/javascript">
function showhide(){
var a=document.getElementById('form2')
if(a.style.display==''){
a.style.display='none';
}else{
a.style.display='';
}
}
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center"></div>
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" ><!--#include file="../include/header.asp" --></td>
</tr>
</table>
<table width="600" align="center">
<tr>
<td height="380" width="73%" align="top" bgcolor="#ffffff">
<div align="center">
<% if (session("adminname")<>"") then
%>
<!--#include file="../include/loggedmenu.asp"-->
<%
end if
%>
<table width="773" border="1" align="center" class="tablesubheader">
<tr>
<td><strong>:: <a href="<%=level%>admin/Tournaments/prt_tourlist.asp" class="loggedmenulink"> Print Reports</a> :: :: <a href="<%=level%>admin/Members/ad_matchs.asp" class="loggedmenulink"> Set Pairings</a> :: <a href="<%=level%>admin/Members/pairings.asp?TourID=<%=teamTourRS("TourID")%>" class="loggedmenulink">:: View Pairings :: :: Edit Tournaments</a> :: </strong></td>
</tr>
</table>
<br>
<table width="69%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" class="errtext"><div align="left" class="KT_tngtable">
<p class="Estilo3">Tournament Matchups</p>
<table width="401" height="60" border="2">
<tr>
<td width="170"><b>Tournament :</b> <%=rstour2("TourName") %></td>
<% TeamsRegistered = rsTour2("MaxTeams") - rsTour2("AvailableSpots") %>
<td width="148"><b>Teams Limit :</b> <%=TeamsRegistered %> </td>
</tr>
<tr>
<td><b>Tee Times: </b> <%=rsTour2("TeeTimes")%> </td>
<td><b>Spots Left :<%=(Recordset4.Fields.Item("AvailableSpots").Value)%></b></td>
</tr>
</table>
<%
' Check for minimum # players or Teams in so The Pairings can be formed correctly...
PlayersIn = Recordset4("MaxTeams") - Recordset4("AvailableSpots")
'response.write " PLayer IN : " & PlayersIn
If Recordset4("MinimumTeams").value > PlayersIn Then %>
<table width="600" border="2">
<tr>
<td class="errtext">Warning : The Minimum # of Teams Has not been Met, Please wait Until Number is reached. </td>
</tr>
</table>
<% end If %>
<p class="textbold"><u>Please Set the Pairings for Each Team</u></p>
<span class="Estilo7">
<%
if rsTeamPlayers.bof then
%>
</span>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"><tr>
<td align="center" class="errtext">Not User Have Confirmed thier Registration </td>
</tr></table>
<%
response.End()
end if %>
<form name="form1" method="post" action="">
<table height="80" border="2" align="center" style="width: 753px">
<tr bgcolor="#CCCCCC">
<td class="style1" style="width: 141px"><div align="left">Team Name </div></td>
<td class="style1"><div align="left">Member Name</div></td>
<td class="style1"><div align="left">Handicap</div></td>
<td class="style1"><div align="left">Team Handicap</div></td>
<td class="style1"><div align="left">Group #<span class="lcontainer" style="width: 51px"></span></div></td>
<td width="79" class="style1"><div align="left">Flight</div></td>
<td class="style1" style="width: 108px"><div align="left">Starting Hole</div></td>
<td width="42" style="width: 19px" class="style1"><div align="left">Check</div></td>
</tr>
<div align="center">
<%
if not rsTour2.EOF then
nct = rsTour2("MaxTeams")
else
nct= 1
End if
rsTeamPlayers.movefirst
For p=1 to nct
if not rsTeamPlayers.eof then
ID=rsTeamPlayers("ID")
TIID=rsTeamPlayers("TIID")
username=rsTeamPlayers("SSN")
teamname=rsTeamPlayers("teamname")
teamleader=rsTeamPlayers("TeamLeader")
firstname=rsTeamPlayers("firstname")
lastname=rsTeamPlayers("lastname")
regdate=rsTeamPlayers("regdate")
GHIN_No=rsTeamPlayers("GHIN")
mstatus=rsTeamPlayers("status")
courseid=rsTeamPlayers("CourseID")
handicap= rsTeamPlayers("Handicap")
TeamNumberPlayers= rsTeamPlayers("TeamTournamentMembers")
paidTourFee = rsTeamPlayers("PaidFee")
TeamNumber = rsTeamPlayers("TeamNumber")
AvgHandicap = rsTeamPlayers("AdjustedTeamHandicap")
PlayerTourID = rsTeamPlayers("TourID")
' From Players Table Displaying ON Report
'TourFlight = rsTour2("Flight")
StartingTime =rsTour2("StartingTime")
FirstHole = rsTour2("StartHole")
if (Request.Form("Save")<>"" ) Then
txtGroupSelected= request.form("GroupSelect"&p)
arrGroup = split(txtGroupSelected, "|") 'split the select value on | delimiter, and create array in arrGroup
if ubound(arrGroup) > 0 then
txtGroupSelected = arrGroup(0) 'assign original group value from =i
txtx3Value = arrGroup(1) 'assign values you showed in x3 e.g. Group # 1
txtTeeTime = arrGroup(2) 'assign values you showed in x2
end if
MatchSelect = Request.Form("MatchSelect"&p)
txtstarthole = Request.Form("StartHole"&p)
txtflightSelect = Request.Form("flightSelect"&p)
' To set the Matchup ID go incremented
set rs_val = Server.Createobject("ADODB.Recordset")
ccnt=0
c=0
sql_res_val="select max(MatchID) from Matchups" 'Team ID
rs_val.open sql_res_val,conSQL
if rs_val(0)<>"" Then
MatchID = rs_val(0)+1
Else
MatchID = "0001"
End if
consql.execute("Set IDENTITY_INSERT Matchups ON Insert into Matchups (MatchID,TIID,TeamNumber,TeamName,PlayerFirstName,PlayerLastName,AdjustedTeamHandicap,TourID,GroupNumber,TournamentMatch,TeeOffTime,StartingHole,Flight,GroupID) values ('"&MatchID&"','"&TIID&"','"&TeamNumber&"','"&TeamName&"','"&firstname&"','"&lastname&"','"&AvgHandicap&"','"&PlayerTourID&"','"&txtgroupSelected&"','"&MatchSelect&"','"&txtTeeTime&"','"&txtStartHole&"','"&txtflightSelect&"','"&GroupID&"')")
'consql.execute("Set IDENTITY_INSERT Matchups ON UPDATE Matchups SET GroupNumber = '"&txtgroupSelected&"' WHERE TIID = '"&TIID&"' ")
If Err.Number <> 0 Then
Response.Write "Error: " & Err.Description
response.end
end if
url="successful.asp"
end if
%>
<%
'----------------------------------- Code Included Here ----------------'
if Last_TIID <> TIID then
' add things here on the blank row..
%>
</div>
<tr><td colspan="15" bgcolor="#000000" height="2px"></td></tr><%
End If
'-----------------------------------------------------------------------'
%>
<tr>
<td class="lcontainer" style="width: 141px"><span class="text2">
<% if ( rsTeamPlayers("teamleader")= true ) then %>
<%=teamname%><% end if %> </a></span></td>
<td width="82" class="lcontainer" style="width: 91px"><a href="memview.asp?ID=<%=ID%>" >
<%=firstname%>,<%=lastname%> </a></td>
<td width="53" class="lcontainer" style="width: 51px"><span class="text2"><%=handicap%></span></td>
<td width="86" class="lcontainer" style="width: 51px"><span class="text2"><% if ( rsTeamPlayers("teamleader")= true ) then %> <%=AvgHandicap%><%end if%></span></td>
<td width="53" class="lcontainer" style="width: 51px">
<span class="lcontainer" style="width: 51px">
<select name="GroupSelect<%=p%>" id="GroupSelect<%=p%>" >
<%
Dim mins, hrs
While (NOT Recordset1.EOF)
for i=1 to CInt(rsTour2("TeeTimes").Value)
'x2 = x + (rsTour2("TeeIntervals").Value * i)
x2 = DateAdd("n", rsTour2("TeeIntervals").Value * i, x)
' Extract minutes from "x" and add interval
mins = DatePart("n", x) + (rsTour2("TeeIntervals").Value * i)
hrs = Recordset2.Fields.Item("StartingHour").Value
' Determine hour increment, cycling on 60 minutes
If (mins >= 60) Then
hrs = hrs + (mins \ 60) ' Increment the hour for every 60 cycle
mins = mins Mod 60 ' Cycle minutes every 60
End If
x2 = hrs & ":" & Right("0" & mins, 2)
x3 = "Group #" &i
%>
<option value="<%=i%>|<%=x3%>|<%=x2%>"><%=x3%> : <%=x2%></option>
<%
Next
if not recordset1.eof then
Recordset1.MoveNext()
end if
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
</span></td>
<td>
<% if ( rsTeamPlayers("teamleader")= true ) then
'' SUBSTITUE MATCH NUMBER FOR FLIGHT NAME!!!!
%>
<select name="flightSelect<%=p%>" id="flightSelect<%=p%>">
<option value selected="0">Select One</option>
<%
While (NOT Recordset2.EOF)
if Recordset2.Fields.Item("Flight1") <> "" then
%>
<option value="<%=(Recordset2.Fields.Item("Flight1").Value)%>"><%=(Recordset2.Fields.Item("Flight1").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight2") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight2").Value)%>"><%=(Recordset2.Fields.Item("Flight2").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight3") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight3").Value)%>"><%=(Recordset2.Fields.Item("Flight3").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight4") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight4").Value)%>"><%=(Recordset2.Fields.Item("Flight4").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight5") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight5").Value)%>"><%=(Recordset2.Fields.Item("Flight5").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight6") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight6").Value)%>"><%=(Recordset2.Fields.Item("Flight6").Value)%></option>
<% end if%>
<%
Recordset2.MoveNext()
Wend
If (Recordset2.CursorType > 0) Then
Recordset2.MoveFirst
Else
Recordset2.Requery
End If
%>
</select>
</td>
<% end if %>
<td style="width: 108px">
<% if ( rsTeamPlayers("teamleader")= true ) then %>
<select name="StartHole<%=p%>" id="StartHole">
<option value="NA">Select One</option>
<option value="1">Hole #1</option>
<option value="2">Hole #2</option>
<option value="3">Hole #3</option>
<option>Hole #4</option>
<option>Hole #5</option>
<option>Hole #6</option>
<option>Hole #7</option>
<option>Hole #8</option>
<option>Hole #9</option>
<option>Hole #10</option>
<option>Hole #11</option>
<option>Hole #12</option>
<option>Hole #13</option>
<option>Hole #14</option>
<option>Hole #15</option>
<option>Hole #16</option>
<option>Hole #17</option>
<option>Hole #18</option>
</select></td>
<% end if %> <% if ( rsTeamPlayers("teamleader")= true ) then %>
<td style="width: 19px"><label>
<input type="checkbox" name="checkmatch<%=p%>" id="checkmatch<%=p%>">
</label></td>
<% end if %>
</tr>
<%
i = i + 1
'------------- Code included here -------------'
Last_TIID = TIID
'----------------------------------------------'
rsTeamPlayers.movenext
end if
next
Recordset2.Close()
Set Recordset2 = Nothing
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
teamTourRS.Close()
Set teamTourRS = Nothing
%>
<%
rsMatches.Close()
Set rsMatches = Nothing
%>
<%
rsTeamPlayers.Close()
Set rsTeamPlayers = Nothing
If "" <> Trim(Request.Form("Save")) AND "" <> Trim(url) Then
Response.Redirect(url)
Response.End
End If
%> </table>
<div class="style2"><span style="width: 19px">
<br>
<input name="Save" type="submit" id="Save" onClick="YY_checkform('form1','checkmatch<%=p%>','#q','1','Field \'checkmatch<%=p%>\' is not valid.','StartHole','#q','1','Field \'StartHole\' is not valid.');return document.MM_returnValue" value="Save Changes">
</span></div>
<p align="right"> </p>
</form>
</div></td>
<tr>
<td><!--#include file="../include/footer.asp"--></td>
</tr>
</table>
</body>
</html>
<%
Recordset4.Close()
Set Recordset4 = Nothing
%>
>>Not really. What I did was to leave a drop down for each team to avoid this
What do you mean by: avoid this?
Avoid what?
===========
The demo that I supplied does what you need it to do. (Or atleast I thought it would due to your instructions)
It Updates the GroupNumber
WHERE the MatchID is 1 (Or what ever number that it is)
Then it updates ONLY the records that Match the MatchID=1
You need to explain it a little better then what you have, in order for me to be able to assist you better in this issue.
What do you mean by: avoid this?
Avoid what?
===========
The demo that I supplied does what you need it to do. (Or atleast I thought it would due to your instructions)
It Updates the GroupNumber
WHERE the MatchID is 1 (Or what ever number that it is)
Then it updates ONLY the records that Match the MatchID=1
You need to explain it a little better then what you have, in order for me to be able to assist you better in this issue.
ASKER
Hello, Yes, I need to loop through the form and insert in all players the GroupNamber without having a dropdown for each one.
Is this still an Issue Ricky?
Lets get this one resolved OK?
Let me know what else that you need, This thing is old, and needs to be done.
Carrzkiss
Lets get this one resolved OK?
Let me know what else that you need, This thing is old, and needs to be done.
Carrzkiss
ASKER
OK this is teh case that we a have a team format golf tournament, in whcih I dont want to set a group for each team member so i want somehow insert in database the group all members belong , please see code attached and live page :
http://playerscores.net/admin/members/ad_setpairings.asp?TourID=44
http://playerscores.net/admin/members/ad_setpairings.asp?TourID=44
<%@LANGUAGE="VBSCRIPT"%>
<% level="../../"%>
<!-- include file="../logincheck.asp"-->
<!--#include file="../include/intialize.inc"-->
<!--#include file="../../../Connections/sqlConn1.asp" -->
<%
T_Players = request.QueryString("TourID")
session ("S_TeamID") =request.QueryString("TourID")
Dim teamTourRS
Dim teamTourRS_cmd
Dim teamTourRS_numRows
Set teamTourRS_cmd = Server.CreateObject ("ADODB.Command")
teamTourRS_cmd.ActiveConnection = MM_sqlConn1_STRING
teamTourRS_cmd.CommandText = "SELECT * FROM dbo.tblTournament where TourID ="&T_Players&" "
teamTourRS_cmd.Prepared = true
Set teamTourRS = teamTourRS_cmd.Execute
teamTourRS_numRows = 0
' check for team or individual
tourFormat = teamTourRS("TourType").value
if tourFormat = "Individual" then
response.Redirect("ad_pairings.asp?TourID="&T_Players&"")
end if
%>
<%
Dim Recordset4
Dim Recordset4_cmd
Dim Recordset4_numRows
Set Recordset4_cmd = Server.CreateObject ("ADODB.Command")
Recordset4_cmd.ActiveConnection = MM_sqlConn1_STRING
Recordset4_cmd.CommandText = "SELECT TourName, TourNoplayers, AvailableSpots, MaxTeams,MinimumPlayers,MinimumTeams, TeamsPerHole, TeeTimes, TeeIntervals, MaxGroups, StartingHour, NumberofGroups, NumberofMatches, MatchesperGroup, TournamentFormat, GroupNumber, MatchNumber, MaxPlayers,HolesPlayed FROM dbo.tblTournament where TourID ="&T_Players&" "
Recordset4_cmd.Prepared = true
Set Recordset4 = Recordset4_cmd.Execute
Recordset4_numRows = 0
%>
<%
Dim matchTest
Dim matchTest_cmd
Dim matchTest_numRows
Set matchTest_cmd = Server.CreateObject ("ADODB.Command")
matchTest_cmd.ActiveConnection = MM_sqlConn1_STRING
matchTest_cmd.CommandText = "SELECT * from dbo.Players Where TeamLeader = 'True' and TourID ="&T_Players&" Order by TeamNumber"
matchTest_cmd.Prepared = true
Set matchTest = matchTest_cmd.Execute
matchTest_numRows = 0
%>
<%
Dim rstour2
Dim rstour2_cmd
Dim rstour2_numRows
Set rstour2_cmd = Server.CreateObject ("ADODB.Command")
rstour2_cmd.ActiveConnection = MM_sqlConn1_STRING
rstour2_cmd.CommandText = "SELECT TourID, TourName, TourDesc, TourNoplayers, TourStartdate, AvailableSpots, MaxTeams, CourseID, StartingTime,HolesPlayed, StartHole,Flight, TeamsPerHole, TeeTimes, TeeIntervals, MaxGroups, StartingHour, StartingMinute, NumberofGroups, NumberofMatches, MatchesperGroup, TournamentFormat, GroupNumber, MatchNumber, MaxPlayers FROM dbo.tblTournament where TourID ="&T_Players&" ORDER BY TourID ASC"
rstour2_cmd.Prepared = true
Set rstour2 = rstour2_cmd.Execute
rstour2_numRows = 0
%>
<%
Dim Recordset2
Dim Recordset2_cmd
Dim Recordset2_numRows
Set Recordset2_cmd = Server.CreateObject ("ADODB.Command")
Recordset2_cmd.ActiveConnection = MM_sqlConn1_STRING
Recordset2_cmd.CommandText = "SELECT Flight1,Flight2,Flight3,Flight4,Flight5,Flight6,StartingTime, StartingHour, StartingMinute FROM dbo.tblTournament where TourID ="&T_Players&""
Recordset2_cmd.Prepared = true
Set Recordset2 = Recordset2_cmd.Execute
Recordset2_numRows = 0
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_sqlConn1_STRING
Recordset1_cmd.CommandText = "SELECT Count(StartingTime) as Cnt, StartingTime FROM dbo.tblTournament where TourID ="&T_Players&" Group By StartingTime "
Recordset1_cmd.Prepared = true
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
If Recordset1.EOF then
'no record , need handle it.
end if
totalplayer = Recordset1("Cnt")
%>
<%
Dim rsMatches
Dim rsMatches_cmd
Dim rsMatches_numRows
Set rsMatches_cmd = Server.CreateObject ("ADODB.Command")
rsMatches_cmd.ActiveConnection = MM_sqlConn1_STRING
rsMatches_cmd.CommandText = "SELECT * FROM dbo.Players where TourID ="&T_Players&" and TeamLeader = 'True' Order by TeamNumber "
rsMatches_cmd.Prepared = true
Set rsMatches = rsMatches_cmd.Execute
rsMatches_numRows = 0
%>
<%
Dim rsTeamPlayers
Dim rsTeamPlayers_cmd
Dim rsTeamPlayers_numRows
Set rsTeamPlayers_cmd = Server.CreateObject ("ADODB.Command")
rsTeamPlayers_cmd.ActiveConnection = MM_sqlConn1_STRING
rsTeamPlayers_cmd.CommandText = "SELECT * FROM dbo.Players where TourID ="&T_Players&" order by TeamNumber, AdjustedTeamHandicap,TIID asc,TeamLeader desc "
rsTeamPlayers_cmd.Prepared = true
Set rsTeamPlayers = rsTeamPlayers_cmd.Execute
rsTeamPlayers_numRows = 0
%>
<html>
<head>
<title><%=PageTitle%></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../style/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo3 {
font-size: 18px;
color: #000000;
}
-->
</style>
<script language=javascript>
function checkDrop() {
if (document.form1.drop1.value == "Colors") document.getElementById("Colors").style.display='';
else document.getElementById("Colors").style.display='none';
}
function hideColors() {
document.getElementById("Colors").style.display="none";
}
</script>
<script type="text/javascript">
function showhide(){
var a=document.getElementById('test')
if(a.style.display==''){
a.style.display='none';
}else{
a.style.display='';
}
}
</script>
<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function YY_checkform() { //v4.66
//copyright (c)1998,2002 Yaromat.com
var args = YY_checkform.arguments; var myDot=true; var myV=''; var myErr='';var addErr=false;var myReq;
for (var i=1; i<args.length;i=i+4){
if (args[i+1].charAt(0)=='#'){myReq=true; args[i+1]=args[i+1].substring(1);}else{myReq=false}
var myObj = MM_findObj(args[i].replace(/\[\d+\]/ig,""));
myV=myObj.value;
if (myObj.type=='text'||myObj.type=='password'||myObj.type=='hidden'){
if (myReq&&myObj.value.length==0){addErr=true}
if ((myV.length>0)&&(args[i+2]==1)){ //fromto
var myMa=args[i+1].split('_');if(isNaN(myV)||myV<myMa[0]/1||myV > myMa[1]/1){addErr=true}
} else if ((myV.length>0)&&(args[i+2]==2)){
var rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-z]{2,4}$");if(!rx.test(myV))addErr=true;
} else if ((myV.length>0)&&(args[i+2]==3)){ // date
var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);
if(myAt){
var myD=(myAt[myMa[1]])?myAt[myMa[1]]:1; var myM=myAt[myMa[2]]-1; var myY=myAt[myMa[3]];
var myDate=new Date(myY,myM,myD);
if(myDate.getFullYear()!=myY||myDate.getDate()!=myD||myDate.getMonth()!=myM){addErr=true};
}else{addErr=true}
} else if ((myV.length>0)&&(args[i+2]==4)){ // time
var myMa=args[i+1].split("#"); var myAt=myV.match(myMa[0]);if(!myAt){addErr=true}
} else if (myV.length>0&&args[i+2]==5){ // check this 2
var myObj1 = MM_findObj(args[i+1].replace(/\[\d+\]/ig,""));
if(myObj1.length)myObj1=myObj1[args[i+1].replace(/(.*\[)|(\].*)/ig,"")];
if(!myObj1.checked){addErr=true}
} else if (myV.length>0&&args[i+2]==6){ // the same
var myObj1 = MM_findObj(args[i+1]);
if(myV!=myObj1.value){addErr=true}
}
} else
if (!myObj.type&&myObj.length>0&&myObj[0].type=='radio'){
var myTest = args[i].match(/(.*)\[(\d+)\].*/i);
var myObj1=(myObj.length>1)?myObj[myTest[2]]:myObj;
if (args[i+2]==1&&myObj1&&myObj1.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
if (args[i+2]==2){
var myDot=false;
for(var j=0;j<myObj.length;j++){myDot=myDot||myObj[j].checked}
if(!myDot){myErr+='* ' +args[i+3]+'\n'}
}
} else if (myObj.type=='checkbox'){
if(args[i+2]==1&&myObj.checked==false){addErr=true}
if(args[i+2]==2&&myObj.checked&&MM_findObj(args[i+1]).value.length/1==0){addErr=true}
} else if (myObj.type=='select-one'||myObj.type=='select-multiple'){
if(args[i+2]==1&&myObj.selectedIndex/1==0){addErr=true}
}else if (myObj.type=='textarea'){
if(myV.length<args[i+1]){addErr=true}
}
if (addErr){myErr+='* '+args[i+3]+'\n'; addErr=false}
}
if (myErr!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+myErr)}
document.MM_returnValue = (myErr=='');
}
//-->
</script>
<link href="../../../includes/skins/formal/tng.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/formal/wdg.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/kollection/tng.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/kollection/wdg.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/kollection/cal.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/arktic/tng.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/arktic/wdg.css" rel="stylesheet" type="text/css">
<link href="../../../includes/skins/arktic/nav.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.Estilo7 {color: #000102}
.style1 {
text-align: center;
}
.style2 {
text-align: right;
}
-->
</style>
</head>
<script language=Javascript>
function del_member(ssn)
{
delconfirm = confirm("Are you Sure To delete this Record");
if (delconfirm)
window.location = "ad_Tourmemlisting.asp?<%=request.ServerVariables("QUERY_STRING")%>&action=delete&ID="+ssn;
}
</script>
<script type="text/javascript">
function showhide(){
var a=document.getElementById('form2')
if(a.style.display==''){
a.style.display='none';
}else{
a.style.display='';
}
}
</script>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div align="center"></div>
<table width="60%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" ><!--#include file="../include/header.asp" --></td>
</tr>
</table>
<table width="600" align="center">
<tr>
<td height="380" width="73%" align="top" bgcolor="#ffffff">
<div align="center">
<% if (session("adminname")<>"") then
%>
<!--#include file="../include/loggedmenu.asp"-->
<%
end if
%>
<table width="773" border="1" align="center" class="tablesubheader">
<tr>
<td><strong>:: <a href="<%=level%>admin/Tournaments/prt_tourlist.asp" class="loggedmenulink"> Print Reports</a> :: :: <a href="<%=level%>admin/Members/ad_matchs.asp" class="loggedmenulink"> Set Pairings</a> :: <a href="<%=level%>admin/Members/pairings.asp?TourID=<%=teamTourRS("TourID")%>" class="loggedmenulink">:: View Pairings :: :: Edit Tournaments</a> :: </strong></td>
</tr>
</table>
<br>
<table width="69%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center" class="errtext"><div align="left" class="KT_tngtable">
<p class="Estilo3">Tournament Matchups</p>
<table width="401" height="60" border="2">
<tr>
<td width="170"><b>Tournament :</b> <%=rstour2("TourName") %></td>
<% TeamsRegistered = rsTour2("MaxTeams") - rsTour2("AvailableSpots") %>
<td width="148"><b>Teams Limit :</b> <%=TeamsRegistered %> </td>
</tr>
<tr>
<td><b>Tee Times: </b> <%=rsTour2("TeeTimes")%> </td>
<td><b>Spots Left :<%=(Recordset4.Fields.Item("AvailableSpots").Value)%></b></td>
</tr>
</table>
<%
' Check for minimum # players or Teams in so The Pairings can be formed correctly...
PlayersIn = Recordset4("MaxTeams") - Recordset4("AvailableSpots")
'response.write " PLayer IN : " & PlayersIn
If Recordset4("MinimumTeams").value > PlayersIn Then %>
<table width="600" border="2">
<tr>
<td class="errtext">Warning : The Minimum # of Teams Has not been Met, Please wait Until Number is reached. </td>
</tr>
</table>
<% end If %>
<p class="textbold"><u>Please Set the Pairings for Each Team</u></p>
<span class="Estilo7">
<%
if rsTeamPlayers.bof then
%>
</span>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"><tr>
<td align="center" class="errtext">Not User Have Confirmed thier Registration </td>
</tr></table>
<%
response.End()
end if %>
<form name="form1" method="post" action="">
<table height="80" border="2" align="center" style="width: 753px">
<tr bgcolor="#CCCCCC">
<td class="style1" style="width: 141px"><div align="left">Team Name </div></td>
<td class="style1"><div align="left">Member Name</div></td>
<td class="style1"><div align="left">Handicap</div></td>
<td class="style1"><div align="left">Team Handicap</div></td>
<td class="style1"><div align="left">Group #<span class="lcontainer" style="width: 51px"></span></div></td>
<% ' check if is a flighted tournament
if not (Recordset2("Flight1") = "" and Recordset2("Flight2")="") then %>
<td width="79" class="style1"><div align="left">Flight</div></td>
<% End If %>
<td class="style1" style="width: 108px"><div align="left">Starting Hole</div></td>
<td width="42" style="width: 19px" class="style1"><div align="left">Check</div></td>
</tr>
<div align="center">
<%
if not rsTour2.EOF then
nct = rsTour2("MaxTeams")
else
nct= 1
End if
rsTeamPlayers.movefirst
For p=1 to nct
if not rsTeamPlayers.eof then
ID=rsTeamPlayers("ID")
TIID=rsTeamPlayers("TIID")
username=rsTeamPlayers("SSN")
teamname=rsTeamPlayers("teamname")
teamleader=rsTeamPlayers("TeamLeader")
firstname=rsTeamPlayers("firstname")
lastname=rsTeamPlayers("lastname")
regdate=rsTeamPlayers("regdate")
GHIN_No=rsTeamPlayers("GHIN")
mstatus=rsTeamPlayers("status")
courseid=rsTeamPlayers("CourseID")
handicap= rsTeamPlayers("Handicap")
TeamNumberPlayers= rsTeamPlayers("TeamTournamentMembers")
paidTourFee = rsTeamPlayers("PaidFee")
TeamNumber = rsTeamPlayers("TeamNumber")
AvgHandicap = rsTeamPlayers("AdjustedTeamHandicap")
PlayerTourID = rsTeamPlayers("TourID")
' From Players Table Displaying ON Report
'TourFlight = rsTour2("Flight")
StartingTime =rsTour2("StartingTime")
FirstHole = rsTour2("StartHole")
if (Request.Form("Save")<>"" ) Then
txtGroupSelected= request.form("GroupSelect"&p)
arrGroup = split(txtGroupSelected, "|") 'split the select value on | delimiter, and create array in arrGroup
if ubound(arrGroup) > 0 then
txtGroupSelected = arrGroup(0) 'assign original group value from =i
txtx3Value = arrGroup(1) 'assign values you showed in x3 e.g. Group # 1
txtTeeTime = arrGroup(2) 'assign values you showed in x2
end if
MatchSelect = Request.Form("MatchSelect"&p)
txtstarthole = Request.Form("StartHole"&p)
txtflightSelect = Request.Form("flightSelect"&p)
' To set the Matchup ID go incremented
set rs_val = Server.Createobject("ADODB.Recordset")
ccnt=0
c=0
sql_res_val="select max(MatchID) from Matchups" 'Team ID
rs_val.open sql_res_val,conSQL
if rs_val(0)<>"" Then
MatchID = rs_val(0)+1
Else
MatchID = "0001"
End if
consql.execute("Set IDENTITY_INSERT Matchups ON Insert into Matchups (MatchID,TIID,TeamNumber,TeamName,PlayerFirstName,PlayerLastName,AdjustedTeamHandicap,TourID,GroupNumber,TournamentMatch,TeeOffTime,StartingHole,Flight,GroupID) values ('"&MatchID&"','"&TIID&"','"&TeamNumber&"','"&TeamName&"','"&firstname&"','"&lastname&"','"&AvgHandicap&"','"&PlayerTourID&"','"&txtgroupSelected&"','"&MatchSelect&"','"&txtTeeTime&"','"&txtStartHole&"','"&txtflightSelect&"','"&GroupID&"')")
'consql.execute("Set IDENTITY_INSERT Matchups ON UPDATE Matchups SET GroupNumber = '"&txtgroupSelected&"' WHERE TIID = '"&TIID&"' ")
If Err.Number <> 0 Then
Response.Write "Error: " & Err.Description
response.end
end if
url="successful.asp"
end if
%>
<%
'----------------------------------- Code Included Here ----------------'
if Last_TIID <> TIID then
' add things here on the blank row..
%>
</div>
<tr><td colspan="15" bgcolor="#000000" height="2px"></td></tr><%
End If
'-----------------------------------------------------------------------'
%>
<tr>
<td class="lcontainer" style="width: 141px"><span class="text2">
<% if ( rsTeamPlayers("teamleader")= true ) then %>
<%=teamname%><% end if %> </a></span></td>
<td width="82" class="lcontainer" style="width: 91px"><a href="memview.asp?ID=<%=ID%>" >
<%=firstname%>,<%=lastname%> </a></td>
<td width="53" class="lcontainer" style="width: 51px"><span class="text2"><%=handicap%></span></td>
<td width="86" class="lcontainer" style="width: 51px"><span class="text2"><% if ( rsTeamPlayers("teamleader")= true ) then %> <%=AvgHandicap%><%end if%></span></td>
<td width="53" class="lcontainer" style="width: 51px">
<span class="lcontainer" style="width: 51px">
<select name="GroupSelect<%=p%>" id="GroupSelect<%=p%>" >
<%
Dim mins, hrs
While (NOT Recordset1.EOF)
for i=1 to CInt(rsTour2("TeeTimes").Value)
'x2 = x + (rsTour2("TeeIntervals").Value * i)
x2 = DateAdd("n", rsTour2("TeeIntervals").Value * i, x)
' Extract minutes from "x" and add interval
mins = DatePart("n", x) + (rsTour2("TeeIntervals").Value * i)
hrs = Recordset2.Fields.Item("StartingHour").Value
' Determine hour increment, cycling on 60 minutes
If (mins >= 60) Then
hrs = hrs + (mins \ 60) ' Increment the hour for every 60 cycle
mins = mins Mod 60 ' Cycle minutes every 60
End If
x2 = hrs & ":" & Right("0" & mins, 2)
x3 = "Group #" &i
%>
<option value="<%=i%>|<%=x3%>|<%=x2%>"><%=x3%> : <%=x2%></option>
<%
Next
if not recordset1.eof then
Recordset1.MoveNext()
end if
Wend
If (Recordset1.CursorType > 0) Then
Recordset1.MoveFirst
Else
Recordset1.Requery
End If
%>
</select>
</span></td>
<% ' check if is a flighted tournament
if not (Recordset2("Flight1") = "" and Recordset2("Flight2")="") then %>
<td>
<% if ( rsTeamPlayers("teamleader")= true ) then
'' SUBSTITUE MATCH NUMBER FOR FLIGHT NAME!!!!
%>
<select name="flightSelect<%=p%>" id="flightSelect<%=p%>">
<option value selected="0">Select One</option>
<%
While (NOT Recordset2.EOF)
if Recordset2.Fields.Item("Flight1") <> "" then
%>
<option value="<%=(Recordset2.Fields.Item("Flight1").Value)%>"><%=(Recordset2.Fields.Item("Flight1").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight2") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight2").Value)%>"><%=(Recordset2.Fields.Item("Flight2").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight3") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight3").Value)%>"><%=(Recordset2.Fields.Item("Flight3").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight4") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight4").Value)%>"><%=(Recordset2.Fields.Item("Flight4").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight5") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight5").Value)%>"><%=(Recordset2.Fields.Item("Flight5").Value)%></option>
<% end if%>
<% if Recordset2.Fields.Item("Flight6") <> "" then %>
<option value="<%=(Recordset2.Fields.Item("Flight6").Value)%>"><%=(Recordset2.Fields.Item("Flight6").Value)%></option>
<% end if%>
<%
Recordset2.MoveNext()
Wend
If (Recordset2.CursorType > 0) Then
Recordset2.MoveFirst
Else
Recordset2.Requery
End If
%>
</select>
</td>
<% End If %>
<% end if %>
<td style="width: 108px">
<% if ( rsTeamPlayers("teamleader")= true ) then %>
<select name="StartHole<%=p%>" id="StartHole">
<option value="NA">Select One</option>
<option>Hole #1</option>
<option>Hole #2</option>
<option>Hole #3</option>
<option>Hole #4</option>
<option>Hole #5</option>
<option>Hole #6</option>
<option>Hole #7</option>
<option>Hole #8</option>
<option>Hole #9</option>
<option>Hole #10</option>
<option>Hole #11</option>
<option>Hole #12</option>
<option>Hole #13</option>
<option>Hole #14</option>
<option>Hole #15</option>
<option>Hole #16</option>
<option>Hole #17</option>
<option>Hole #18</option>
</select></td>
<% end if %> <% if ( rsTeamPlayers("teamleader")= true ) then %>
<td style="width: 19px"><label>
<input type="checkbox" name="checkmatch<%=p%>" id="checkmatch<%=p%>">
</label></td>
<% end if %>
</tr>
<%
i = i + 1
'------------- Code included here -------------'
Last_TIID = TIID
'----------------------------------------------'
rsTeamPlayers.movenext
end if
next
Recordset2.Close()
Set Recordset2 = Nothing
%>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>
<%
teamTourRS.Close()
Set teamTourRS = Nothing
%>
<%
rsMatches.Close()
Set rsMatches = Nothing
%>
<%
rsTeamPlayers.Close()
Set rsTeamPlayers = Nothing
If "" <> Trim(Request.Form("Save")) AND "" <> Trim(url) Then
Response.Redirect(url)
Response.End
End If
%> </table>
<div class="style2"><span style="width: 19px">
<br>
<input name="Save" type="submit" id="Save" onClick="YY_checkform('form1','checkmatch<%=p%>','#q','1','Field \'checkmatch<%=p%>\' is not valid.','StartHole','#q','1','Field \'StartHole\' is not valid.');return document.MM_returnValue" value="Save Changes">
</span></div>
<p align="right"> </p>
</form>
</div></td>
<tr>
<td><!--#include file="../include/footer.asp"--></td>
</tr>
</table>
</body>
</html>
<%
Recordset4.Close()
Set Recordset4 = Nothing
%>
ricky.
Are you trying to say that:
For each name - Select a Group
And Insert into the Database that Group for That name?
Are the checkbox's Dynamic, as in the page can load 3 or 30 members names?
And you are having a problem inserting the Dynamic ComboBox's into the Database?
What is the [Checkbox] for?
Please let me know the above.
Thanks and have a good one.
Carrzkiss
Are you trying to say that:
For each name - Select a Group
And Insert into the Database that Group for That name?
Are the checkbox's Dynamic, as in the page can load 3 or 30 members names?
And you are having a problem inserting the Dynamic ComboBox's into the Database?
What is the [Checkbox] for?
Please let me know the above.
Thanks and have a good one.
Carrzkiss
ASKER
hi , no, for each team use only one group, but somwhow insert into database for every team member , not dynamic checkboxes, yes thats the problem, i could not do it having only on combobox , so i put one for each member,,,
the task is to have one combobox per team and when inserting insert say fro team experts players , group 7 in every member...
the task is to have one combobox per team and when inserting insert say fro team experts players , group 7 in every member...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes . Thanks a lot.
Please correct this:
(This is Flight2,you have it as:Flight1
<% if Recordset2.Fields.Item("Fl
<option value="<%=(Recordset2.Fiel
<% end if%>
OK.
Are you referring to this:
<select name="GroupSelect<%=p%>" id="GroupSelect<%=p%>" >
As being the value that you want to give to ALL the Members of the group?
Why don't you just use an Update statement?
Update 1 columns within' the table [Players] # or what ever it is called?
Example:
UPDATE TableName SET TableName.FieldName = 1;
This example, will update all the values in all the records in the TableName.FieldName
Try and see if that is what you want.
(Try it on a sample Table, not your actual table)