<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<?php session_start();
if(isset($_SESSION['email']))
{
echo "";
}
else
{
	header( "Location: login.php" ); 
}
?>
<html>
 <head>
  <title> New Document </title>
  <meta name="Generator" content="EditPlus">
  <meta name="Author" content="">
  <meta name="Keywords" content="">
  <meta name="Description" content="">
  <style type="text/css">
  h1 {
	font-family: Calibri;
	color: black;
	font-size: 24;
	text-align:left;
}
 
p {
	font-family: Calibri;
	color: black;
	font-size: 20;
}
td
{
	font-family: Calibri;
	color: black;
	font-size: 20;
	text-align:center;
}
</style>
 </head>
 
 <body style="font-size:2;font-family:arial;color:black;background-image:url('gray.jpg');background-size:100% 100%;
background-repeat:no-repeat;">
 <h1>
YOUR TRADING HISTORY</h1>
<script type="text/javascript" language="javascript">
<!--
function OpenPopup (c) {
	window.open(c,
	'window',
	'width=480,height=480,scrollbars=yes,status=yes');
	}
//--> </script> 
<?php
$con= mysql_connect("localhost:3306","","");
if (!$con)
{
	die('Could not connect: ' . mysql_error());
}
mysql_select_db("test", $con);
$email=$_SESSION['email'];
$useridres=mysql_query("select userid from userdata where Email='$email';");
while($row=mysql_fetch_array($useridres))
{
	$userid=$row['userid'];
}
$tableresult=mysql_query("select * from orders where userid=$userid;");
$count = mysql_num_rows($tableresult);
$i=0;
while($row = mysql_fetch_array($tableresult))
		  {
			$tickersymbol[$i]=$row['tickersymbol'];
			$company[$i]=$row['company'];
			$price[$i]=$row['price'];
			$action[$i]=$row['action'];
			$order_type[$i]=$row['order_type'];
			$quantity[$i]=$row['quantity'];
			$transaction_date[$i]=$row['transaction_date'];
			$status[$i]=$row['status'];
			$commission[$i]=$row['commission'];
			$i++;
		  }
echo "<table align='left' border=1 width='773px'>";
echo "<tr>";
echo "<td>TICKER</td>";
echo "<td>COMPANY</td>";
echo "<td>PRICE</td>";
echo "<td>ACTION</td>";
echo "<td>ORDER-TYPE</td>";
echo "<td>QUANTITY</td>";
echo "<td>DATE</td>";
echo "<td>STATUS</td>";
echo "<td>COMMISSION</td>";
echo "<td>COMMENTS</td>";
echo "</tr>";
for($i=0;$i<$count;$i++)
{
echo "<tr>";
echo "<td>$tickersymbol[$i]</td>";
echo "<td>$company[$i]</td>";
echo "<td>$price[$i]$</td>";
echo "<td>$action[$i]</td>";
echo "<td>$order_type[$i]</td>";
echo "<td>$quantity[$i]</td>";
echo "<td>$transaction_date[$i]</td>";
echo "<td>$status[$i]</td>";
echo "<td>$commission[$i]$</td>";
echo "<td><a href='http://localhost/stocks/tradecomments.php?ticker=$tickersymbol[$i] & date= $transaction_date[$i]' onclick='OpenPopup(this.href); return false'><img border='0' src='pencil.png' width='20' /></a></td>";
echo "</tr>";
}
echo "</table>";

?>


  
</body>
</html>
