-2
I’m trying to insert a table but when I add it, it keeps popping up my code like it’s a text, but it works lol.
Does anyone know what’s wrong with my code that I can’t find?
<?php
session_start();
include 'mysql_connect.php';
include 'season_info.php';
if ($_SESSION['HoopsUser'] != NULL)
{
if (isset($_GET['Sort']))
{
$sort = $_GET['Sort'];
if ($sort == 'Age')
{
$age = 'Age_Asc';
}
else
{
$age = 'Age';
}
}
if (isset($_GET['Position']))
{
$position = $_GET['Position'];
$and = '&Position='.$position.'';
{
if ($position == 'Draft')
{
$and = '&Position='.$position.'';
}
else if ($position == 'FA')
{
$and = '&Position='.$position.'';
}
else if ($position == 'Prev')
{
}
else if ($position == 1)
{
}
else if ($position == 2)
{
}
else if ($position == 3)
{
}
else if ($position == 4)
{
}
else if ($position == 5)
{
}
}
}
else
{
}
echo '
</td>
</tr>
</table>' . "\n";
$sql = 'SELECT *, freeagencycoach.ID AS ID FROM freeagencycoach INNER JOIN Staff ON freeagencycoach.Player = Staff.ID WHERE CurrentTeam = 0 AND User = \''.$_SESSION['HoopsUser'].'\' AND Year = '.$year.' AND Years > 0 AND Amount > 0';
$result = mysql_query($sql) or die(mysql_error());
$count = mysql_num_rows($result);
if ($count > 0)
{
echo '
<table class="middle2" cellpadding="0">
<tr>
<td width="800" valign="top" align="center">
<table width="100%" align="center" cellspacing="1" style="border-style:solid;border-width:1px;border-color:#909090">
<tr class="stat_header">
<td align="left" colspan="25" style="padding-left:6px">Current Offers</td>
</tr>
<tr class="header">
<td align="left" style="padding-left:4px">PLAYER</td>
<td align="left" style="padding-left:4px">OFFER</td>
<td align="center" style="padding-left:4px;padding-right:4px">CANCEL</td>
</tr>' . "\n";
}
while ($row = mysql_fetch_assoc($result))
{
$player = '<a href="player.php?ID='.$row['Player'].'" class="link">' . $row['Name'] . '</a>';
if (0 == ($x++ & 1)) { $sClass = 'odd'; } else { $sClass = 'even'; }
$sql2 = 'SELECT Player, Pos FROM ContractRequests WHERE ID = '.$row['Player'].'';
$result2 = mysql_query($sql2) or die(mysql_error());
while ($row2 = mysql_fetch_assoc($result2))
{
$player = '<a href="player.php?ID='.$row['Player'].'" class="link">' . $row2['Player'] . '</a>, ' . $row2['Pos'];
}
if ($row['Years'] == 99)
{
$contract = 'Max offer';
}
else if ($row['Amount'] == 0) {
$contract = 'Min offer';
}
else
{
$contract = '$'.number_format($row['Amount']).'/'.$row['Years'].' yr(s)';
}
echo ' <tr class="'.$sClass.'">
<td align="left" style="padding-left:4px">'.$player.'</td>
<td align="left" style="padding-left:4px">'.$contract.'</td>
<td align="center" style="padding-left:4px;padding-right:4px"><a href="freeagency_withdraw.php?Offer='.$row['ID'].'" class="link">Withdraw</a></td>
</tr>' . "\n";
}
if ($count > 0)
{
echo '
</table>
</td>
</tr>
</table>' . "\n";
}
if (isset($_GET['Position']))
{
if ($_GET['Position'] == 'Prev') {
$prev_year = $year - 1;
$where = 'INNER JOIN SeasonStats ON SeasonStats.ID = Player.ID WHERE SeasonStats.Season = '.$prev_year.' AND SeasonStats.Team = \''.$_SESSION['HoopsTeam'].'\' AND CurrentTeam = \'FA\'';
} else {
$where = 'WHERE CurrentTeam = \'FA\' AND PositionNumber = '.$_GET['Position'].'';
}
}
else
{
$where = 'WHERE CurrentTeam = \'FA\'';
}
if (isset($_GET['Sort']))
{
$sort = $_GET['Sort'];
if ($sort == 'Age_Asc')
{
$sort = 'Player.Age';
$by = '';
}
else if ($sort == 'FutureRating')
{
$sort = 'FutureRating';
$by = '';
}
else if ($sort == 'Age')
{
$sort = 'Player.Age';
$by = 'DESC';
}
else
{
$by = 'DESC';
}
}
else
{
$sort = 'Overall';
$by = 'DESC';
}
{
$rank++;
$name = $row['FirstName'] . ". " . $row['LastName'];
$id = $row['ID'];
$team = '<a href="clubhouse.php?Team='.$row['Abbr'].'" class="link">'.$row['Abbr'].'</a>';
$pos = $row['PositionNumber'];
if ($row['PositionNumber'] == 1) { $pos = 'C'; } else if ($row['PositionNumber'] == 2) { $pos = 'PF'; }
else if ($row['PositionNumber'] == 3) { $pos = 'SF'; } else if ($row['PositionNumber'] == 4) { $pos = 'SG'; }
else if ($row['PositionNumber'] == 5) { $pos = 'PG'; }
$age = $row['Age'];
$exp = $row['Experience'];
$ovr = number_format($row['Overall'],0);
$inches = $row['Height'];
$ft = floor($inches/12);
$in = $inches % 12;
$ht = $ft . '\'' . $in . '"';
$wt = $row['Weight'];
$ins = $row['InsideScoring'];
$jps = $row['JumpShot'];
$ft = $row['FreeThrowShot'];
$tp = $row['ThreePointShot'];
$pas = $row['Passing'];
$hnd = $row['Handling'];
$orb = $row['OffensiveRebounding'];
$drb = $row['DefensiveRebounding'];
$psd = $row['PostDefense'];
$prd = $row['PerimeterDefense'];
$stl = $row['Stealing'];
$blk = $row['ShotBlocking'];
$jmp = $row['Jumping'];
$qkn = $row['Quickness'];
$sth = $row['Strength'];
$sta = $row['Stamina'];
$ovr = number_format($row['Overall'],0);
$fut = $row['FutureRating'];
if ($row['BirdYears'] >= 3 && $_GET['Position'] == 'Prev') {
$bird_rights = '<sup><font style="font-size:8px;font-family:Verdana;color:#009900">BIRD</font></sup>';
} else {
$bird_rights = '';
}
if ($sort == 'Player.Age') { $class1 = ' class="sort_bold"'; }
if ($sort == 'Overall') { $class2 = ' class="sort_bold"'; }
if ($sort == 'InsideScoring') { $class3 = ' class="sort_bold"'; }
if ($sort == 'JumpShot') { $class4 = ' class="sort_bold"'; }
if ($sort == 'FreeThrowShot') { $class5 = ' class="sort_bold"'; }
if ($sort == 'ThreePointShot') { $class6 = ' class="sort_bold"'; }
if ($sort == 'Handling') { $class7 = ' class="sort_bold"'; }
if ($sort == 'Passing') { $class8 = ' class="sort_bold"'; }
if ($sort == 'OffensiveRebounding') { $class9 = ' class="sort_bold"'; }
if ($sort == 'DefensiveRebounding') { $class10 = ' class="sort_bold"'; }
if ($sort == 'PostDefense') { $class11 = ' class="sort_bold"'; }
if ($sort == 'PerimeterDefense') { $class12 = ' class="sort_bold"'; }
if ($sort == 'Stealing') { $class13 = ' class="sort_bold"'; }
if ($sort == 'ShotBlocking') { $class14 = ' class="sort_bold"'; }
if ($sort == 'Quickness') { $class15 = ' class="sort_bold"'; }
if ($sort == 'Strength') { $class16 = ' class="sort_bold"'; }
if ($sort == 'Jumping') { $class17 = ' class="sort_bold"'; }
if ($sort == 'Stamina') { $class18 = ' class="sort_bold"'; }
// InsideScoring*0.3+JumpShot*0.09+ThreePointShot*1.5+Handling*0.2+Passing*2+OffensiveRebounding*4+DefensiveRebounding*4+PostDefense+PerimeterDefense*3+Stealing+ShotBlocking*0.8+Quickness*0.7+Jumping*0.5+Strength
if (0 == ($i++ & 1)) { $sClass = 'odd'; }
else { $sClass = 'even'; }
if ($sort == 'Player.Age')
{
$sort = 'Age';
}
if ($row[''.$sort.''] != $last_stat)
{
$last_stat = $row[''.$sort.''];
$rank = $i;
}
else
{
$rank = ' ';
}
echo ' <tr class="'.$sClass.'">
</tr>';
if ($i % 20 == 0 && $i != 100 && $i != 250)
{
echo '
<tr class="header">
<td align="left" style="padding-left:4px">PLAYER</td>
<td align="right" style="padding-right:4px">AGE</td>
<td align="right" style="padding-right:4px">EXP</td>
<td align="center" style="padding-left:2px;padding-right:2px">CUR</td>
<td align="center" style="padding-left:2px;padding-right:2px">POT</td>
<td align="right" style="padding-right:4px">OVR</td>
<td align="right" style="padding-right:4px">INS</td>
<td align="right" style="padding-right:4px">JPS</td>
<td align="right" style="padding-right:4px">FT</td>
<td align="right" style="padding-right:4px">3PS</td>
<td align="right" style="padding-right:4px">HND</td>
<td align="right" style="padding-right:4px">PAS</td>
<td align="right" style="padding-right:4px">ORB</td>
<td align="right" style="padding-right:4px">DRB</td>
<td align="right" style="padding-right:4px">PSD</td>
<td align="right" style="padding-right:4px">PRD</td>
<td align="right" style="padding-right:4px">STL</td>
<td align="right" style="padding-right:4px">BLK</td>
<td align="right" style="padding-right:4px">QKN</td>
<td align="right" style="padding-right:4px">STR</td>
<td align="right" style="padding-right:4px">JMP</td>
</tr>';
}
}
echo '
<tr>
</tr>
</table>
</form>
</td>
</tr>
</table>
<br>';
if ($_SESSION['HoopsUser'] == 'admin') {
echo $sql;
}
}
else
{
$redirect = urlencode($_SERVER['REQUEST_URI']);
echo "<meta http-equiv=\"refresh\" content=\"0;URL=login.php?location=$redirect\">";
echo '
<table class="middle3">
<tr>
<td>
<table class="maintop">
<tr>
<td><font class="playersubhead">Access Restricted</font></td>
</tr>
</table>
</td>
</tr>
</table>
<table class="middle2">
<tr>
<td width="800" valign="top" align="center">
<table width="100%" align="center" cellspacing="1">
<tr class="odd">
<td colspan="20" align="left" style="padding-left:6px">You must be logged in to access this page!</td>
</tr>
</table>
</td>
</tr>
</table>
<br>
';
}
you have print of the problem occurred?
– Luan Brito
https://i.postimg.cc/tCz5k2KR/print.png
– Maycon
I can’t identify the mistake.
– Maycon
If you don’t like to document your beauty codes. At least give a highlight when entering test code otherwise it happens, you end up forgetting in the code a test fragment that by chance may come to the production environment and generate an unpleasant surprise for your customer.
– Augusto Vasques