Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Any ideas on this one?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Any ideas on this one?

 Post Reply Post Reply
Author
flapper View Drop Down
Newbie
Newbie
Avatar

Joined: 27 January 2003
Location: England
Status: Offline
Points: 8
Post Options Post Options   Thanks (0) Thanks(0)   Quote flapper Quote  Post ReplyReply Direct Link To This Post Topic: Any ideas on this one?
    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

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") & "

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 19 March 2003 at 11:01am
would help if you post the error instead of asking someone to wade though this code.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.