Print Page | Close Window

Any ideas on this one?

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=1137
Printed Date: 29 March 2026 at 12:52pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Any ideas on this one?
Posted By: flapper
Subject: Any ideas on this one?
Date Posted: 19 March 2003 at 5:14am

I've created a website using ASP to admin a mini- football league;

http://www34.brinkster.com/imleague - http://www34.brinkster.com/imleague

sign up and take a look round....

anyways when you signed in theres a page with 4 tables showing results/new/fixtures & league tables.

Ok if there are no fixtures/results or teams entered i get errors.

 

The Code i use for each part is below:

 

no forthcoming fixtures to be played!

<table border='0' ALIGN=CENTER><tr><th class=tdgrey1 colspan='4'>FORTHCOMING FIXTURES</th></tr><TR><TD>&nbsp</TD></TR>
<%
set rsFix = Server.CreateObject("ADODB.Recordset")
rsFix.Open "SELECT * FROM Fixture ORDER BY date DESC", conn, 3, 1
rsFix.MoveFirst
do until rsFix.Eof
 if x < 4 then
  response.write "<tr><td><a href='view.asp?strSel=" & rsFix("home_team") & "&func=club'>" & rsFix("home_team") & "</td>"
  response.write "<td>.v.</td>"
  response.write "<td><a href='view.asp?strSel=" & rsFix("away_team") & "&func=club'>" & rsFix("away_team") & "</td>"
  response.write "<td>" & rsFix("date") & "</td>"
  response.write ""
  response.write ""
  response.write "</tr>"
 end if
 x = x + 1
 rsfix.MoveNext
loop
%>
  </table>

No results entered:

Heres the other one if NO results are entered!

  <TD width="265" VALIGN=TOP style="border-left: 1px solid rgb(0,0,0); border-top: 1px solid rgb(0,0,0); border-bottom: 1px solid rgb(0,0,0)">

   <table border='0' ALIGN=CENTER>
    <tr><th class=tdgrey1 colspan='4'>LATEST RESULTS</th></tr>
    <tr><th>Fix</th><th>Home</th><th></th><th>Away</th></tr>
<%
set rsFix = Server.CreateObject("ADODB.Recordset")
rsFix.Open "SELECT * FROM Fixture WHERE home_goals <> null ORDER BY date DESC;", conn, 2, 1
rsFix.MoveFirst
x = 0
do until rsFix.Eof
 if x < 4 then
  response.write "<tr>"
  response.write "<td>"
  response.write "<a href=javascript:openwin('match_report.asp?fix=" & rsFix("fixture_id") & "','description')>" & rsFix("fixture_id") & "</a>"
  response.write "</td>"
  response.write "<td><a href='view.asp?strSel=" & rsFix("home_team") & "&func=club'>" & rsFix("home_team") & "</td>"
  response.write "<td>" & rsFix("home_goals") & "</td>"
  response.write "<td><a href='view.asp?strSel=" & rsFix("away_team") & "&func=club'>" & rsFix("away_team") & "</td>"
  response.write "<td>" & rsFix("away_goals") & "</td>"
  response.write "</tr>"
 end if
 x = x + 1
 rsfix.MoveNext
loop
%>
  </table>

 

No teams entered:

<%
intWon = 0
intDrw = 0
intLos = 0
intPld = 0
intPoints = 0
intgf = 0
intga = 0
strQuery = ""
Set rsMatchs = Server.CreateObject("ADODB.Recordset")
set rsTeams = Server.CreateObject("ADODB.Recordset")
set rsLeague = Server.CreateObject("ADODB.Recordset")
rsTeams.open "Select club_name FROM Club", Conn, 1,3
do until rsTeams.Eof
 strClub = rsTeams("club_name")
 strQuery = "SELECT fixture.home_team, fixture.away_team, fixture.home_goals, " & _
                 "fixture.away_goals " & _
              "FROM club, fixture " & _
              "WHERE fixture.home_team=club.club_name AND club.club_name='" & strClub & _
                 "' AND fixture.home_goals is not null " & _
              "OR fixture.away_team=club.club_name and club.club_name='" & strClub & _
                 "' AND fixture.away_goals is not null"
 rsMatchs.Open strQuery, Conn, 1,3
 DO WHILE NOT rsMatchs.EOF
  intPld = intPld + 1
  IF strClub = rsMatchs("home_team") THEN
   IF rsMatchs("home_goals") > rsMatchs("away_goals") THEN
    intWon = intWon + 1
    intPoints = intPoints + 3
    gf = gf + rsMatchs("home_goals")
   END IF
   IF rsMatchs("home_goals") < rsMatchs("away_goals") THEN intLos = intLos + 1
   IF rsMatchs("home_goals") = rsMatchs("away_goals") THEN
    intDrw = intDrw + 1
    intPoints = intPoints + 1
   END IF
  intgf = intgf + rsMatchs("home_goals")
  intga = intga + rsMatchs("away_goals")
  END IF
  IF strClub = rsMatchs("away_team") THEN
   IF rsMatchs("home_goals") < rsMatchs("away_goals") THEN
    intWon = intWon + 1
    intPoints = intPoints + 3
   END if
   IF rsMatchs("home_goals") > rsMatchs("away_goals") THEN intLos = intLos + 1
   IF rsMatchs("home_goals") = rsMatchs("away_goals") THEN
    intDrw = intDrw + 1
    intPoints = intpoints + 1
   END IF
  intgf = intgf + rsMatchs("away_goals")
  intga = intga + rsMatchs("home_goals")
  END IF
  rsMatchs.MoveNext
 LOOP
 rsLeague.open "SELECT * FROM league", conn, 1, 3
 rsLeague.addnew
 rsLeague("Clb") = strClub
  rsLeague("Pld") = intPld
  rsLeague("won") = intWon
  rsLeague("drw") = intDrw
  rsLeague("los") = intLos
        rsLeague("gf") = intgf
        rsLeague("ga") = intga
        rsLeague("gd") = intgf - intga
 rsLeague("pnt") = intPoints
 rsLeague.update
 rsLeague.close
 rsMatchs.close
 intWon = 0
 intLos = 0
 intDrw = 0
 intPld = 0
 intPoints = 0
 intgf = 0
 intga = 0
 rsTeams.MoveNext ' Movenext
loop
response.write "<table border='0' width='95%' align='center'>" & _
 "<tr><th colspan='10' class=tdgrey1>LEAGUE TABLE</th></tr>" & _
 "<tr><th></th><th width=60>Club</th><th>P</th><th>W</th><th>D</th><th>L</th>" & _
 "<th>GF</th><th>GA</th><th>GD</th><th>Pts</th></tr>"
rsLeague.open "SELECT * FROM League ORDER BY pnt DESC, gd DESC", conn, 1, 3
do until rsLeague.Eof
   intX = intX + 1
   if intX < 5 then
    response.write "<tr><td>" & intX & "</td><td><a href='view.asp?strSel=" & rsLeague("clb") & _
    "&func=club'>" & rsLeague("clb") & "</a></td><td>" & _
    rsLeague("pld") & "




Replies:
Posted By: michael
Date Posted: 19 March 2003 at 11:01am
would help if you post the error instead of asking someone to wade though this code.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net