here is my code so far:
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<meta name="author" content="" />
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<title>Motor Racing Online</title>
</head>
<body>
<div id="wrapper">
<?php include('includes/header.php');
include('includes/nav.php'); ?>
<div id="content">
<h4>Staff And Facilities</h4>
<?php
include_once 'connect.php';
if(!isset($_SESSION)){
session_start();
}
if (isset($_SESSION['player']))
{
$player=$_SESSION['player'];
}
else
{
echo "Not Logged in <br><br> <A href='login.php'>Login</a>";
exit;
}
$bypass=0;
$playerinfo ="SELECT * from players where name='$player'";
$playerinfo2=mysql_query($playerinfo) or die (mysql_error());
$playerinfo3=mysql_fetch_array($playerinfo2);
$id=$playerinfo3['id'];
$staffinfo ="SELECT * from testing where level='$playerinfo3[level]'" ;
$staffinfo2=mysql_query($staffinfo) or die ("could not get staff stats");
$staffinfo3=mysql_fetch_array($staffinfo2);
$driversname=$playerinfo3['name'];
$levelinfo = "SELECT * from players where level ='$playerinfo3[level]'";
$levelinfo2=mysql_query($levelinfo) or die (mysql_error());
$levelinfo3=mysql_fetch_array($levelinfo2);
$id1info = "SELECT * from groups where id=1";
$id1info2=mysql_query($id1info) or die (mysql_error());
$id1info3=mysql_fetch_array($id1info2);
$id2info = "SELECT * from groups where id=2";
$id2info2=mysql_query($id2info) or die (mysql_error());
$id2info3=mysql_fetch_array($id2info2);
$testing1info = "SELECT * from testing where pid=$id1info3[pid]";
$testing1info2=mysql_query($testing1info) or die (mysql_error());
$testing1info3=mysql_fetch_array($testing1info2);
$testing2info = "SELECT * from testing where pid=$id2info3[pid]";
$testing2info2=mysql_query($testing2info) or die (mysql_error());
$testing2info3=mysql_fetch_array($testing2info2);
if ($testing1info3['lap1'] < $testing1info3['lap2'] && $testing1info3['lap1'] < $testing1info3['lap3'] && $testing1info3['lap1'] < $testing1info3['lap4'] &&
$testing1info3['lap1'] < $testing1info3['lap5'])
{$bestlapid1 = $testing1info3['lap1'];}
elseif($testing1info3['lap2'] < $testing1info3['lap3'] && $testing1info3['lap2'] < $testing1info3['lap4'] && $testing1info3['lap2'] < $testing1info3['lap5'])
{$bestlapid1 = $testing1info3['lap2'];}
elseif($testing1info3['lap3'] < $testing1info3['lap4'] && $testing1info3['lap3'] < $testing1info3['lap5']){$bestlapid1 = $testing1info3['lap3'];}
elseif($testing1info3['lap4'] < $testing1info3['lap5']) {$bestlapid1 = $testing1info3['lap4'];} else {$bestlapid1 = $testing1info3['lap5'];}
if ($testing2info3['lap1'] < $testing2info3['lap2'] && $testing2info3['lap1'] < $testin21info3['lap3'] && $testing2info3['lap1'] < $testing2info3['lap4'] &&
$testing2info3['lap1'] < $testing2info3['lap5'])
{$bestlapid2 = $testing2info3['lap1'];}
elseif($testing2info3['lap2'] < $testing2info3['lap3'] && $testing2info3['lap2'] < $testing2info3['lap4'] && $testing2info3['lap2'] < $testing2info3['lap5'])
{$bestlapid2 = $testing2info3['lap2'];}
elseif($testing2info3['lap3'] < $testing2info3['lap4'] && $testing2info3['lap3'] < $testing2info3['lap5']){$bestlapid2 = $testing2info3['lap3'];}
elseif($testing2info3['lap4'] < $testing2info3['lap5']) {$bestlapid2 = $testing2info3['lap4'];} else {$bestlapid2 = $testing2info3['lap5'];}
$pid=$staffinfo3['pid'];
$laptime1 = $staffinfo3['lap1'];
$laptime2 = $staffinfo3['lap2'];
$laptime3 = $staffinfo3['lap3'];
$laptime4 = $staffinfo3['lap4'];
$laptime5 = $staffinfo3['lap5'];
$a = $laptime1;
date('H:i:s.', substr($a, 0, -3)) . substr($a, -3);
$b = $laptime2;
date('H:i:s.', substr($b, 0, -3)) . substr($b, -3);
$c = $laptime3;
date('H:i:s.', substr($c, 0, -3)) . substr($c, -3);
$d = $laptime4;
date('H:i:s.', substr($d, 0, -3)) . substr($d, -3);
$e = $laptime5;
date('H:i:s.', substr($e, 0, -3)) . substr($e, -3);
if($staffinfo3['tyre'] === 9){
$choice = 'Xtra Soft';
}else if($staffinfo3['tyre']=== 10){
$choice = 'Soft';
}else if ($staffinfo3['tyre']===11){
$choice = 'Medium';
}else if ($staffinfo3['tyre']===12){
$choice = 'Hards';
}
echo "<h2>Your Completed Testing laps</h2>";
echo"<small>";
print "<center>";
print "<table border='0' width='70%' cellspacing='5'>";
print "<tr><td width='25%' valign='top'>";
print "</td>";
print "<td valign='top' width='75%'>";
print "<table border='0' bgcolor='#f8f8f8'>";
print "<tr><td>Position<font color='f8f8f8'>______________________</font></td><td>Managers Name<font color='f8f8f8'>______</td>
<td>Best Lap Time <font color='f8f8f8'>______</td><td>Gap<font color='f8f8f8'>______</td></tr>";
print "<tr><td>1<font color='f8f8f8'>_______</font></td><td>";echo "$id1info3[name]"; print "<font color='f8f8f8'>______</td>
<td>";echo date('i:s.', substr($bestlapid1, 0, -3)) . substr($bestlapid1, -3);echo "<font color='f8f8f8'>______</td></tr>";
print "<tr><td>"; if ($testing2info3['hastested'] == 1){echo "2";}
print "<font color='f8f8f8'>_______</font></td><td>";if ($testing2info3['hastested'] == 1) {echo "$id2info3[name]";}else{}; print "<font color='f8f8f8'>______</td>
<td>";if ($testing2info3['hastested'] == 1) {echo date('i:s.', substr($bestlapid2, 0, -3)) . substr($bestlapid2, -3);}
echo "<font color='f8f8f8'>______</td><td></tr>";
print "</table>";
print "</td></tr></table>";
print "</center>";
?>
</div> <!-- end #content -->
<?php include('includes/sidebar.php'); ?>
<?php include('includes/footer.php'); ?>
</div> <!-- End #wrapper -->
</body>
</html>