Location: PHPKode > projects > PHP Project Manager > testrunlist.php
<?php
include "includes/header.php";
?>
<!--- ADD NEW TEST --->
<h2>PHP Test Manager - Previous Test Runs</h2>
<div id="main_table">
	<table width="100%" cellspacing="0" cellpadding="2">
	<tr>
		<th class="tablehead" style="text-align:left;" width="25%">Test Run Name</th>
		<th class="tablehead" width="25%">Project</th>
		<th class="tablehead" width="5%">No of Tests</th>
		<th class="tablehead" width="5%">Complete</th>
		<th class="tablehead" width="5%">%</th>
		<th class="tablehead" width="10%">Date Last Ran</th>
		<th class="tablehead" width="5%">Delete</th>
		<th class="tablehead" width="5%">Continue Run</th>
	</tr>
<?php
include 'scripts/db.php';

   // connect to mysql
   $connection=mysql_connect($hostName,$username,$password)
   or die("Unable to connect to SQL Server");
   // connect to database
	mysql_select_db($databaseName,$connection)
	or die("Unable to select database");
		
	// query
	$query = "SELECT * from ".$d_ext."subtest ORDER BY Test_RunID ;";

	// run query
	$result=mysql_query($query, $connection)
	or die("Unable to run query on database");
	// fetch results
	$rowCheck=0;
	$test_show=0;
	for ($rowCounter = 0;$row = @ mysql_fetch_array($result);$rowCounter++) 
	{
	if($row['Test_RunID']<>$test_show)
	{
	echo "<form method=\"post\" action=\"runexistingtest.php\">";
	if(($rowCheck%2)==1)
	$color_class="class1";
	else
	$color_class="class2";
	echo "<tr>";
	$rowCheck++;
	$test=gettestname($row['Test_Name']);
	echo "\n<td style=\"text-align:left;\" class=\"".$color_class."\">".$test."</td>";
	echo "\n<td class=\"".$color_class."\">".$row['Project']."</td>";
	echo "\n<td class=\"".$color_class."\">";
	$totaltests=count_totaltests($row['Test_RunID']);
	echo $totaltests;

	echo "</td>";
	echo "\n<td class=\"".$color_class."\">";
	$completetests=count_completetests($row['Test_RunID']);
	echo $completetests;

	echo "</td>";
	echo "\n<td class=\"".$color_class."\">";
	$completepct=round(($completetests/$totaltests)*100,2);
	echo $completepct."%";

	echo "</td>";
	$rundate=date_sort($row['Date']);
	echo "\n<td class=\"".$color_class."\">".$rundate."</td>";
	echo "\n<td class=\"".$color_class."\">";
	echo "<input type=\"hidden\" id=\"project_id\" value=\"".$row['Project']."\" name=\"project_id\" />";
	echo "<input type=\"hidden\" id=\"testrun_id\" value=\"".$row['Test_RunID']."\" name=\"testrun_id\" />"; 
	echo "\n<img src=\"images/button_delete.gif\" onclick=\"delete_run(" . $row['Test_RunID'] . ");\" style=\"margin-right:5px;border:0;\" alt=\"Delete Test\">";	
	echo "</td>";
	echo "\n<td class=\"".$color_class."\"><input type=\"image\" src=\"images/button_runtest.gif\" style=\"margin-right:5px;border:0;\" alt=\"Run Test\"></td>";
	echo "</tr></form>";
	$test_show=$row['Test_RunID'];
	}
	}
	// close database connection
	mysql_close($connection);
?>	

	</table>
	</div>

<!---/ ADD NEW TEST --->
</div>
<!--/ MAIN CONTENT AREA -->
<?php
include "includes/footer.php";
?>
Return current item: PHP Project Manager