Location: PHPKode > projects > PHP Project Manager > runexistingtest.php
<?php
include "includes/header.php";

$testrunid=$_POST["testrun_id"];
$project=$_POST["project_id"];
?>
<!--- ADD NEW TEST --->
<h2>Running Test - Project: <?php echo $project; ?></h2>
<div id="main_table">
			<form method="post" action="scripts/existrun_complete.php">
			<table width="100%" cellspacing="0" cellpadding="2">
				<tr>
					<th class="tablehead" style="text-align:left;" width="30%">Test Step Name</th>
					<th class="tablehead" width="10%">Pass</th>
					<th class="tablehead" width="60%">Test Run Description</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 to get full details of test run
	$query = "SELECT * from ".$d_ext."subtest WHERE Test_RunID='$testrunid' LIMIT 1;";	
	// run query
	$result=mysql_query($query, $connection)
	or die("Unable to run query on database");
	// fetch results
	$rowCheck=0;
	for ($rowCounter = 0;$row = @ mysql_fetch_array($result);$rowCounter++) 
	{
	$testrun=$row['Test_Name'];	
	}
	// query to get Test_Run ID
	$query = "SELECT * from ".$d_ext."maintest WHERE Test_Name='$testrun' LIMIT 1;";	
	// run query
	$result=mysql_query($query, $connection)
	or die("Unable to run query on database");
	// fetch results
	$rowCheck=0;
	for ($rowCounter = 0;$row = @ mysql_fetch_array($result);$rowCounter++) 
	{
	$testrun=$row['Test_ID'];	
	}

	// query
	$query = "SELECT * from ".$d_ext."maintest WHERE Test_Run='$testrun' ORDER BY 'Order';";

	// run query
	$result=mysql_query($query, $connection)
	or die("Unable to run query on database");
	// fetch results
	$rowCheck=0;
	for ($rowCounter = 0;$row = @ mysql_fetch_array($result);$rowCounter++) 
	{

	if(($rowCheck%2)==1)
	$color_class="class1";
	else
	$color_class="class2";
	echo "<tr>";
	$rowCheck++;
	echo "\n<td class=\"".$color_class."\" style=\"text-align:left;\">";
	if($row['Related_URL']<>"")echo "<a href=\"".stripslashes($row['Related_URL'])."\">" . stripslashes($row['Test_Name']) . "</a>";
	else echo stripslashes($row['Test_Name']);
	echo "</td>";
	// Determine if checkbox has been checked

	echo "\n<td class=\"".$color_class."\"><input type=\"checkbox\" ";
	test_complete($row['Test_ID'],$testrunid);
	echo " name=\"chk".$row['Test_ID']."\" id=\"chk".$row['Test_ID']."\" ></td>";
	echo "\n<td class=\"".$color_class."\" style=\"text-align:justify;\">" . stripslashes($row['Test_Description']) . "</td>";
	echo "</tr>";
	}

	echo "\n<td class=\"".$color_class."\" style=\"text-align:left;\"><input type=\"hidden\" id=\"project_id\" name=\"project_id\" value=\"".$project."\">";
	echo "<input type=\"hidden\" id=\"testrunid\" name=\"testrunid\" value=\"".$testrunid."\">";
	echo "<input type=\"hidden\" id=\"testrun\" name=\"testrun\" value=\"".$testrun."\">";
	echo "<input type=\"hidden\" id=\"testrunname\" name=\"testrunname\" value=\"".$testrunname."\">
	</td>";
	echo "\n<td class=\"".$color_class."\"><input type=\"image\" style=\"border:0;\" src=\"images/button_update.gif\" alt=\"Finish Test Run\"></form></td>";
	echo "\n<td class=\"".$color_class."\" style=\"text-align:justify;\">&nbsp;</form></td>";
?>
	</table>
	</div>

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