LJ Host
10-11-2004, 03:25 PM
I need a little help with a php / mysql issue as my programmer is out of town.
I am not very familiar with PHP personally so please bear with me.
I am getting errors on this page (http://badgerpoker.com/milwaukee/board_new.php)
It is not live as the real board is located here. (http://badgerpoker.com/milwaukee/board.php) If you'll notice the new board archives the previous series.
Here is an example of how it is supposed to function. Functioning Example (http://badgerpoker.com/madison/board.php)
This is in a different section of the site using a different database.
Here is the code from the broken page:
<? require_once('../inc/prepend.inc.php'); ?>
<?
$u = array();
$series_query = mysql_query("select max(series) as series from events", $conn);
$series_result = mysql_fetch_array($series_query);
$max_series = $series_result['series'];
$rs2 = mysql_query("SELECT users.id as uid, sum(points) as sp, seats.*, events.*, users.* from seats inner join users on users.id=seats.userid inner join events on events.id=seats.eventid inner join `hosts` on `hosts`.id=events.hostid where events.series = $max_series group by userid order by sp desc", $conn) or die(mysql_error());
$i=1;
$cc = 0;
$ccr = 0;
while ($row2 = mysql_fetch_assoc($rs2))
{
if ($cc < 40)
{
// Check if he got 20 at least once
$rs2c = mysql_query("SELECT count(*) as c from seats inner join events on events.id=seats.eventid where events.series = $max_series and points=20 and userid =".$row2["uid"], $conn) or die(mysql_error()."SELECT count(*) as c from seats where points=20 and userid =".$row2["uid"]);
$row2c = mysql_fetch_assoc($rs2c);
$ccs = $row2c["c"];
if ($row2c["c"] > 0)
{
$cc++;
// Register user
$u[] = $row2["uid"];
// Select total for this user
$rs2c = mysql_query("SELECT sum(points) as s from seats inner join events on events.id=seats.eventid where events.series = $max_series and userid =".$row2["uid"], $conn) or die(mysql_error()."SELECT sum(points) as s from seats where userid =".$row2["uid"]);
$row2c = mysql_fetch_assoc($rs2c);
$rr[$ccr] = array("wins" => $ccs, "s" => $row2c["s"], "name" => $row2["fname"]." ".$row2["lname"]);
$ss[$ccr] = $row2c["s"];
$ccr++;
}
}
};
//
//
//
//
$rs2 = mysql_query("SELECT users.id as uid, sum(points) as sp, seats.*, events.*,users.* from seats inner join users on users.id=seats.userid inner join events on events.id=seats.eventid inner join `hosts` on `hosts`.id=events.hostid where events.series = $max_series group by userid order by sp desc", $conn) or die(mysql_error());
$cc = 0;
while ($row2 = mysql_fetch_assoc($rs2))
{
if (!in_array($row2["uid"], $u) && $row2["sp"] > 0 && $cc < 40)
{
$cc++;
// Register user
$u[] = $row2["uid"];
// Select total for this user
$rs2c = mysql_query("SELECT sum(points) as s from seats inner join events on events.id=seats.eventid where events.series = $max_series and userid =".$row2["uid"], $conn) or die(mysql_error());
$row2c = mysql_fetch_assoc($rs2c);
$rr[$ccr] = array("wins" => "Never", "s" => $row2c["s"], "name" => $row2["fname"]." ".$row2["lname"]);
$ss[$ccr] = $row2c["s"];
$ccr++;
}
};
//
// Sort
//
arsort($ss);
reset($ss);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/main_milwaukee.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Welcome - Badger Poker Series</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
}
-->
</style>
<link href="../css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="216" valign="top" background="../images/layout_r2_c4.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="54%" nowrap>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="284" height="78" valign="top"><img src="../images/spacer.gif" width="46" height="37"><a href="index.php"><img src="../images/layout4_mil_r2_c3.gif" width="210" height="216" border="0"></a></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="37"><img src="../images/spacer.gif" width="46" height="37"></td>
</tr>
<tr>
<td nowrap><span id="nav"><a href="index.php">Home</a>
<a href="cp/login.php">My Account </a> <a href="rules.php">Rules</a>
<a href="board.php">Leader Board</a> <a href="events.php">Event
Calendar</a></span></td>
</tr>
<tr>
<td height="145" align="right" valign="top"><br>
<br>
<img src="../images/title.gif" width="320" height="55">
</td>
</tr>
<tr>
<td valign="top">[sponsor] <a href="http://www.pokerroom.com/?ref=5139" target="_blank">Can't
wait? Play poker now for Play or Real Money!</a></td>
</tr>
</table>
</td>
</tr>
</table></td>
<td width="46%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="93%" align="right" nowrap><span id="topnav"><a href="contact.php">Contact</a>
<img src="../images/index_r2_c11.gif" width="11" height="32" align="absmiddle">
<a href="hireus.php">Hire Us</a> </span></td>
<td width="7%"> </td>
</tr>
</table> <span id="topnav"></span></td>
</tr>
<tr>
<td height="160" align="right"><form name="form1" method="post" action="cp/login.php">
<br>
<br>
<br>
<table border="0" cellpadding="1" cellspacing="0">
<tr>
<td align="left" id="white">Email:<br>
<input name="login" type="text" class="inp" id="login" size="12"></td>
<td width="80" align="left" id="white"> </td>
</tr>
<tr>
<td align="left" valign="top" id="white">Password:<br>
<input name="pass" type="password" class="inp" id="pass" size="12"></td>
<td align="left" id="white"> </td>
</tr>
<tr>
<td align="left"><input style="padding-top:3px; padding-bottom:3px;" name="imageField" type="image" src="../images/index_r4_c10.gif" width="69" height="17" border="0">
<br>
<a href="signup.php"><font color="#FFFFFF">Register now</font></a> <br>
<!-- <a href="signup.php"><font color="#FFFFFF">Register now!</font></a>--></td>
<td> </td>
</tr>
</table>
</form></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" id="mainBG">
<tr>
<td><!-- InstanceBeginEditable name="main" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="4%"> </td>
<td width="28%"> </td>
<td width="4%"> </td>
<td width="28%"> </td>
<td width="4%"> </td>
<td width="28%"> </td>
<td width="4%"> </td>
</tr>
<tr>
<td> </td>
<td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" valign="top" background="../images/layout_r7_c3.gif"><table height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td nowrap id="whiteb">Information</td>
</tr>
</table></td>
</tr>
<tr>
<td height="5"> </td>
</tr>
<tr>
<td valign="top"> All players are listed on the Leaderboard. At
the end of the 40 tournaments the 40 winners and 40 non-winner
point leaders will play in the final tournament.
<p> </p></td>
</tr>
</table>
<br> </td>
<td valign="top"> </td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" valign="top" background="../images/layout_r7_c7.gif"><table height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td nowrap id="whiteb">The Leader Board Series <?php echo $max_series; ?></td>
</tr>
</table></td>
</tr>
<!-- Archieved series -->
<?php
$archieve_series = mysql_query("select distinct series from events where series < $max_series and series > 0 order by series", $conn);
if (mysql_numrows($archieve_series) > 0) {
echo '<tr><td>View leaderboard of series: ';
while ($archieve_result = mysql_fetch_array($archieve_series)) {
echo '<a href="javascript:popupWindow(\'board_series.php?series=' . $archieve_result['series'] . '\')"> ' . $archieve_result['series'] . ' </a>';
//echo '<a href="board_series.php?series=' . $archieve_result['series'] . '"> ' . $archieve_result['series'] . ' </a>';
}
echo '</td></tr>';
}
?>
<tr>
<td height="5"> <table width="100%" cellspacing="1" cellpadding="4">
<tr bgcolor="#f0f0f0" class="th">
<td nowrap><strong>Place</strong></td>
<td nowrap><strong>Wins</strong></td>
<td nowrap bgcolor="#f0f0f0"><strong>Points</strong></td>
<td nowrap bgcolor="#f0f0f0"><strong>Player</strong></td>
</tr>
<?
foreach($ss as $sk=>$sv)
{
?>
<tr>
<td><? echo $i;$i++;?></td>
<td><? echo $rr[$sk]["wins"];?></td>
<td><? echo $rr[$sk]["s"];?></td>
<td><? echo $rr[$sk]["name"];?></td>
</tr>
<tr>
<td colspan="6" background="../images/dotg.gif" style=" height:8px;background-repeat:repeat-x; background-position:bottom;"></td>
</tr>
<? }; ?>
<tr class="th" background="../images/dot.gif">
<td colspan="4" background="../images/dot.gif" class="bord" style=" background-repeat:repeat-x; background-position:bottom;"><strong>Final
Tournament Cutoff</strong></td>
</tr>
<!-- Regular users -->
<?
$rs2 = mysql_query("SELECT users.id as uid, sum(points) as sp, seats.*, events.*,users.* from seats inner join users on users.id=seats.userid inner join events on events.id=seats.eventid inner join `hosts` on `hosts`.id=events.hostid where events.series = $max_series group by userid order by sp desc", $conn) or die(mysql_error());
while ($row2 = mysql_fetch_assoc($rs2))
{
if (!in_array($row2["uid"], $u) && $row2["sp"] > 0)
{
// Register user
$u[] = $row2["uid"];
// Select total for this user
$rs2c = mysql_query("SELECT sum(points) as s from seats inner join events on events.id=seats.eventid where events.series = $max_series and userid =".$row2["uid"], $conn) or die(mysql_error());
$row2c = mysql_fetch_assoc($rs2c);
?>
<tr>
<td><? echo $i;$i++;?></td>
<td>Never</td>
<td><? echo $row2c["s"]; ?></td>
<td><? echo $row2["fname"];?> <? echo $row2["lname"];?></td>
</tr>
<tr>
<td colspan="6" background="../images/dotg.gif" style=" height:8px;background-repeat:repeat-x; background-position:bottom;"></td>
</tr>
<? }}; ?>
</table>
<p></p></td>
</tr>
<tr>
<td><p> </p></td>
</tr>
</table></td>
<td valign="top"> </td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" valign="top" background="../images/layout_r7_c10.gif"><table height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td nowrap id="whiteb">Upcoming Events </td>
</tr>
</table></td>
</tr>
<tr>
<td height="5"> </td>
</tr>
<tr>
<td valign="top" style="background-repeat:no-repeat; background-position:right"><?
$rs2 = mysql_query("SELECT events.id as eid, (events.dtstart <= NOW() and events.dtend >= NOW()) as within_range, (events.dtevent < NOW()) as happened, events.*,hosts.* from events inner join hosts on hosts.id = events.hostid where events.dtevent > NOW() and to_days(events.dtevent) <= to_days(NOW())+14 order by dtevent, open", $conn) or die(mysql_error());
?>
<table width="100%" cellspacing="1" cellpadding="4">
<tr bgcolor="#f0f0f0" class="th">
<td nowrap><strong>Sign Up </strong></td>
<td nowrap bgcolor="#f0f0f0"><strong>Date</strong></td>
<td nowrap><strong>Time</strong></td>
<td nowrap><strong>Where</strong></td>
<td nowrap><strong>Phone</strong></td>
<td nowrap><strong>Address</strong></td>
</tr>
<?php while ($row2 = mysql_fetch_assoc($rs2)) { ?>
<tr>
<td><?
$rs4 = mysql_query("select count(*) as c from seats where eventid = ".$row2['eid'], $conn) or die(mysql_error());
$row4 = mysql_fetch_assoc($rs4);
if ($row2['happened'])
echo "Tournament Complete [<a href='#' onClick=\"window.open('scores_popup.php?eid=".$row2['eid']."','tops','width=270,height=400')\";>View scores</a>]";
elseif($row4["c"] >= $row2['maxseats'])
echo "Tournament full";
elseif($row2['open'] && $row2['within_range'])
echo "<a href='cp/regnow.php?eid=".$row2['eid']."'>Register Now!</a>";
else
echo "Not available to register yet";
?></td>
<td><? echo date("m/d/Y", strtotime($row2['dtevent'])); ?></td>
<td><? echo date("g:i A", strtotime($row2['dtevent'])); ?></td>
<td><?php echo $row2['name']; ?></td>
<td><? echo $row2['phone']; ?></td>
<td><? echo $row2['address']; ?></td>
</tr>
<tr>
<td colspan="6" background="../images/dotg.gif" style=" height:8px;background-repeat:repeat-x; background-position:bottom;"></td>
</tr>
<?php }; ?>
</table></td>
</tr>
</table></td>
<td valign="top"> </td>
</tr>
</table>
<!-- InstanceEndEditable --></td>
</tr>
</table>
<br>
<div style="background-color:#2388E7; height:2px;"></div>
<div style="PADDING-RIGHT: 10px; BORDER-TOP: #f8f8f8 1px solid; PADDING-LEFT: 10px; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 1px; COLOR: #444444; PADDING-TOP: 0px; BORDER-BOTTOM: #666666 1px solid">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td nowrap><div align="center"><span id="nav"><a href="index.php">Home</a>
<a href="cp/index.php">My Account</a> <a href="rules.php">
Rules</a> <a href="board.php">Leader Board</a> <a href="events.php">Event
Calendar</a></span></div></td>
<td nowrap> <div align="right">Created and Powered by <a href="http://ljhost.com" target="_blank">LJ
Host</a></div></td>
</tr>
</table>
</div>
</body>
<!-- InstanceEnd --></html>
I am not very familiar with PHP personally so please bear with me.
I am getting errors on this page (http://badgerpoker.com/milwaukee/board_new.php)
It is not live as the real board is located here. (http://badgerpoker.com/milwaukee/board.php) If you'll notice the new board archives the previous series.
Here is an example of how it is supposed to function. Functioning Example (http://badgerpoker.com/madison/board.php)
This is in a different section of the site using a different database.
Here is the code from the broken page:
<? require_once('../inc/prepend.inc.php'); ?>
<?
$u = array();
$series_query = mysql_query("select max(series) as series from events", $conn);
$series_result = mysql_fetch_array($series_query);
$max_series = $series_result['series'];
$rs2 = mysql_query("SELECT users.id as uid, sum(points) as sp, seats.*, events.*, users.* from seats inner join users on users.id=seats.userid inner join events on events.id=seats.eventid inner join `hosts` on `hosts`.id=events.hostid where events.series = $max_series group by userid order by sp desc", $conn) or die(mysql_error());
$i=1;
$cc = 0;
$ccr = 0;
while ($row2 = mysql_fetch_assoc($rs2))
{
if ($cc < 40)
{
// Check if he got 20 at least once
$rs2c = mysql_query("SELECT count(*) as c from seats inner join events on events.id=seats.eventid where events.series = $max_series and points=20 and userid =".$row2["uid"], $conn) or die(mysql_error()."SELECT count(*) as c from seats where points=20 and userid =".$row2["uid"]);
$row2c = mysql_fetch_assoc($rs2c);
$ccs = $row2c["c"];
if ($row2c["c"] > 0)
{
$cc++;
// Register user
$u[] = $row2["uid"];
// Select total for this user
$rs2c = mysql_query("SELECT sum(points) as s from seats inner join events on events.id=seats.eventid where events.series = $max_series and userid =".$row2["uid"], $conn) or die(mysql_error()."SELECT sum(points) as s from seats where userid =".$row2["uid"]);
$row2c = mysql_fetch_assoc($rs2c);
$rr[$ccr] = array("wins" => $ccs, "s" => $row2c["s"], "name" => $row2["fname"]." ".$row2["lname"]);
$ss[$ccr] = $row2c["s"];
$ccr++;
}
}
};
//
//
//
//
$rs2 = mysql_query("SELECT users.id as uid, sum(points) as sp, seats.*, events.*,users.* from seats inner join users on users.id=seats.userid inner join events on events.id=seats.eventid inner join `hosts` on `hosts`.id=events.hostid where events.series = $max_series group by userid order by sp desc", $conn) or die(mysql_error());
$cc = 0;
while ($row2 = mysql_fetch_assoc($rs2))
{
if (!in_array($row2["uid"], $u) && $row2["sp"] > 0 && $cc < 40)
{
$cc++;
// Register user
$u[] = $row2["uid"];
// Select total for this user
$rs2c = mysql_query("SELECT sum(points) as s from seats inner join events on events.id=seats.eventid where events.series = $max_series and userid =".$row2["uid"], $conn) or die(mysql_error());
$row2c = mysql_fetch_assoc($rs2c);
$rr[$ccr] = array("wins" => "Never", "s" => $row2c["s"], "name" => $row2["fname"]." ".$row2["lname"]);
$ss[$ccr] = $row2c["s"];
$ccr++;
}
};
//
// Sort
//
arsort($ss);
reset($ss);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><!-- InstanceBegin template="/Templates/main_milwaukee.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<!-- InstanceBeginEditable name="doctitle" -->
<title>Welcome - Badger Poker Series</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
}
-->
</style>
<link href="../css/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="216" valign="top" background="../images/layout_r2_c4.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="54%" nowrap>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="284" height="78" valign="top"><img src="../images/spacer.gif" width="46" height="37"><a href="index.php"><img src="../images/layout4_mil_r2_c3.gif" width="210" height="216" border="0"></a></td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="37"><img src="../images/spacer.gif" width="46" height="37"></td>
</tr>
<tr>
<td nowrap><span id="nav"><a href="index.php">Home</a>
<a href="cp/login.php">My Account </a> <a href="rules.php">Rules</a>
<a href="board.php">Leader Board</a> <a href="events.php">Event
Calendar</a></span></td>
</tr>
<tr>
<td height="145" align="right" valign="top"><br>
<br>
<img src="../images/title.gif" width="320" height="55">
</td>
</tr>
<tr>
<td valign="top">[sponsor] <a href="http://www.pokerroom.com/?ref=5139" target="_blank">Can't
wait? Play poker now for Play or Real Money!</a></td>
</tr>
</table>
</td>
</tr>
</table></td>
<td width="46%" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="right" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="93%" align="right" nowrap><span id="topnav"><a href="contact.php">Contact</a>
<img src="../images/index_r2_c11.gif" width="11" height="32" align="absmiddle">
<a href="hireus.php">Hire Us</a> </span></td>
<td width="7%"> </td>
</tr>
</table> <span id="topnav"></span></td>
</tr>
<tr>
<td height="160" align="right"><form name="form1" method="post" action="cp/login.php">
<br>
<br>
<br>
<table border="0" cellpadding="1" cellspacing="0">
<tr>
<td align="left" id="white">Email:<br>
<input name="login" type="text" class="inp" id="login" size="12"></td>
<td width="80" align="left" id="white"> </td>
</tr>
<tr>
<td align="left" valign="top" id="white">Password:<br>
<input name="pass" type="password" class="inp" id="pass" size="12"></td>
<td align="left" id="white"> </td>
</tr>
<tr>
<td align="left"><input style="padding-top:3px; padding-bottom:3px;" name="imageField" type="image" src="../images/index_r4_c10.gif" width="69" height="17" border="0">
<br>
<a href="signup.php"><font color="#FFFFFF">Register now</font></a> <br>
<!-- <a href="signup.php"><font color="#FFFFFF">Register now!</font></a>--></td>
<td> </td>
</tr>
</table>
</form></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" id="mainBG">
<tr>
<td><!-- InstanceBeginEditable name="main" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="4%"> </td>
<td width="28%"> </td>
<td width="4%"> </td>
<td width="28%"> </td>
<td width="4%"> </td>
<td width="28%"> </td>
<td width="4%"> </td>
</tr>
<tr>
<td> </td>
<td valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" valign="top" background="../images/layout_r7_c3.gif"><table height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td nowrap id="whiteb">Information</td>
</tr>
</table></td>
</tr>
<tr>
<td height="5"> </td>
</tr>
<tr>
<td valign="top"> All players are listed on the Leaderboard. At
the end of the 40 tournaments the 40 winners and 40 non-winner
point leaders will play in the final tournament.
<p> </p></td>
</tr>
</table>
<br> </td>
<td valign="top"> </td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" valign="top" background="../images/layout_r7_c7.gif"><table height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td nowrap id="whiteb">The Leader Board Series <?php echo $max_series; ?></td>
</tr>
</table></td>
</tr>
<!-- Archieved series -->
<?php
$archieve_series = mysql_query("select distinct series from events where series < $max_series and series > 0 order by series", $conn);
if (mysql_numrows($archieve_series) > 0) {
echo '<tr><td>View leaderboard of series: ';
while ($archieve_result = mysql_fetch_array($archieve_series)) {
echo '<a href="javascript:popupWindow(\'board_series.php?series=' . $archieve_result['series'] . '\')"> ' . $archieve_result['series'] . ' </a>';
//echo '<a href="board_series.php?series=' . $archieve_result['series'] . '"> ' . $archieve_result['series'] . ' </a>';
}
echo '</td></tr>';
}
?>
<tr>
<td height="5"> <table width="100%" cellspacing="1" cellpadding="4">
<tr bgcolor="#f0f0f0" class="th">
<td nowrap><strong>Place</strong></td>
<td nowrap><strong>Wins</strong></td>
<td nowrap bgcolor="#f0f0f0"><strong>Points</strong></td>
<td nowrap bgcolor="#f0f0f0"><strong>Player</strong></td>
</tr>
<?
foreach($ss as $sk=>$sv)
{
?>
<tr>
<td><? echo $i;$i++;?></td>
<td><? echo $rr[$sk]["wins"];?></td>
<td><? echo $rr[$sk]["s"];?></td>
<td><? echo $rr[$sk]["name"];?></td>
</tr>
<tr>
<td colspan="6" background="../images/dotg.gif" style=" height:8px;background-repeat:repeat-x; background-position:bottom;"></td>
</tr>
<? }; ?>
<tr class="th" background="../images/dot.gif">
<td colspan="4" background="../images/dot.gif" class="bord" style=" background-repeat:repeat-x; background-position:bottom;"><strong>Final
Tournament Cutoff</strong></td>
</tr>
<!-- Regular users -->
<?
$rs2 = mysql_query("SELECT users.id as uid, sum(points) as sp, seats.*, events.*,users.* from seats inner join users on users.id=seats.userid inner join events on events.id=seats.eventid inner join `hosts` on `hosts`.id=events.hostid where events.series = $max_series group by userid order by sp desc", $conn) or die(mysql_error());
while ($row2 = mysql_fetch_assoc($rs2))
{
if (!in_array($row2["uid"], $u) && $row2["sp"] > 0)
{
// Register user
$u[] = $row2["uid"];
// Select total for this user
$rs2c = mysql_query("SELECT sum(points) as s from seats inner join events on events.id=seats.eventid where events.series = $max_series and userid =".$row2["uid"], $conn) or die(mysql_error());
$row2c = mysql_fetch_assoc($rs2c);
?>
<tr>
<td><? echo $i;$i++;?></td>
<td>Never</td>
<td><? echo $row2c["s"]; ?></td>
<td><? echo $row2["fname"];?> <? echo $row2["lname"];?></td>
</tr>
<tr>
<td colspan="6" background="../images/dotg.gif" style=" height:8px;background-repeat:repeat-x; background-position:bottom;"></td>
</tr>
<? }}; ?>
</table>
<p></p></td>
</tr>
<tr>
<td><p> </p></td>
</tr>
</table></td>
<td valign="top"> </td>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="40" valign="top" background="../images/layout_r7_c10.gif"><table height="30" border="0" cellpadding="0" cellspacing="0">
<tr>
<td nowrap id="whiteb">Upcoming Events </td>
</tr>
</table></td>
</tr>
<tr>
<td height="5"> </td>
</tr>
<tr>
<td valign="top" style="background-repeat:no-repeat; background-position:right"><?
$rs2 = mysql_query("SELECT events.id as eid, (events.dtstart <= NOW() and events.dtend >= NOW()) as within_range, (events.dtevent < NOW()) as happened, events.*,hosts.* from events inner join hosts on hosts.id = events.hostid where events.dtevent > NOW() and to_days(events.dtevent) <= to_days(NOW())+14 order by dtevent, open", $conn) or die(mysql_error());
?>
<table width="100%" cellspacing="1" cellpadding="4">
<tr bgcolor="#f0f0f0" class="th">
<td nowrap><strong>Sign Up </strong></td>
<td nowrap bgcolor="#f0f0f0"><strong>Date</strong></td>
<td nowrap><strong>Time</strong></td>
<td nowrap><strong>Where</strong></td>
<td nowrap><strong>Phone</strong></td>
<td nowrap><strong>Address</strong></td>
</tr>
<?php while ($row2 = mysql_fetch_assoc($rs2)) { ?>
<tr>
<td><?
$rs4 = mysql_query("select count(*) as c from seats where eventid = ".$row2['eid'], $conn) or die(mysql_error());
$row4 = mysql_fetch_assoc($rs4);
if ($row2['happened'])
echo "Tournament Complete [<a href='#' onClick=\"window.open('scores_popup.php?eid=".$row2['eid']."','tops','width=270,height=400')\";>View scores</a>]";
elseif($row4["c"] >= $row2['maxseats'])
echo "Tournament full";
elseif($row2['open'] && $row2['within_range'])
echo "<a href='cp/regnow.php?eid=".$row2['eid']."'>Register Now!</a>";
else
echo "Not available to register yet";
?></td>
<td><? echo date("m/d/Y", strtotime($row2['dtevent'])); ?></td>
<td><? echo date("g:i A", strtotime($row2['dtevent'])); ?></td>
<td><?php echo $row2['name']; ?></td>
<td><? echo $row2['phone']; ?></td>
<td><? echo $row2['address']; ?></td>
</tr>
<tr>
<td colspan="6" background="../images/dotg.gif" style=" height:8px;background-repeat:repeat-x; background-position:bottom;"></td>
</tr>
<?php }; ?>
</table></td>
</tr>
</table></td>
<td valign="top"> </td>
</tr>
</table>
<!-- InstanceEndEditable --></td>
</tr>
</table>
<br>
<div style="background-color:#2388E7; height:2px;"></div>
<div style="PADDING-RIGHT: 10px; BORDER-TOP: #f8f8f8 1px solid; PADDING-LEFT: 10px; BACKGROUND: #e0e0e0; PADDING-BOTTOM: 1px; COLOR: #444444; PADDING-TOP: 0px; BORDER-BOTTOM: #666666 1px solid">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td nowrap><div align="center"><span id="nav"><a href="index.php">Home</a>
<a href="cp/index.php">My Account</a> <a href="rules.php">
Rules</a> <a href="board.php">Leader Board</a> <a href="events.php">Event
Calendar</a></span></div></td>
<td nowrap> <div align="right">Created and Powered by <a href="http://ljhost.com" target="_blank">LJ
Host</a></div></td>
</tr>
</table>
</div>
</body>
<!-- InstanceEnd --></html>
