Location: PHPKode > projects > PHP Project Manager > maintest.php
<?php
include "includes/header.php";
?>
<!--- ADD NEW TEST --->
<h2>PHP Test Manager</h2>
<div id="main_table">
			<table width="100%" cellspacing="0" cellpadding="2">
				<tr>
					<th class="tablehead" style="text-align:left;" width="30%">Test Run Name</th>
					<th class="tablehead" width="10%">No of Tests</th>
					<th class="tablehead" width="4%">View/Edit</th>
					<th class="tablehead" width="4%">Delete</th>
					<th class="tablehead" width="30%">Project</th>
					<th class="tablehead" width="5%">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."maintest WHERE Test_Description='default' ORDER BY Test_Name;";

	// 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++) 
	{
	echo "<form method=\"post\" action=\"runtest.php\">";
	if(($rowCheck%2)==1)
	$color_class="class1";
	else
	$color_class="class2";
	echo "<tr>";
	$rowCheck++;
	echo "\n<td class=\"".$color_class."\" style=\"text-align:left;\"><a href=\"viewtests.php?testid=".$row['Test_ID']."\">" . stripslashes($row['Test_Name']) . "</a></td>";
	echo "\n<td class=\"".$color_class."\">";
	$tests=count_tests($row['Test_ID']);
	echo $tests;

	echo "</td>";
	echo "\n<td class=\"".$color_class."\"><a href=\"viewtests.php?testid=".$row['Test_ID']."\"><img src=\"images/button_viewtest.gif\" style=\"margin-right:5px;border:0;\" alt=\"View Test\"></a></td>";
	echo "\n<td class=\"".$color_class."\">";
	echo "<input type=\"hidden\" id=\"test_id\" value=\"".$row['Test_ID']."\" name=\"test_id\" />"; 
	echo "<input type=\"hidden\" id=\"testrunname\" value=\"".$row['Test_Name']."\" name=\"testrunname\" />"; 
	if($tests==0)
	{
	echo "\n<img src=\"images/button_delete.gif\" onclick=\"delete_test(" . $row['Test_ID'] . ");\" style=\"margin-right:5px;border:0;\" alt=\"Delete Test\">";	
	}
	else echo "&nbsp;";
	echo "</td>";
	echo "\n<td class=\"".$color_class."\"><select name=\"proj_id\" id=\"proj_id\">";
	load_projects();
	echo "\n</select></td>";
	$target_date=date_sort($row['Project_Target_Date']);
	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>";
	}
	// close database connection
	mysql_close($connection);
?>	
	<tr>
	<td class="class2" style="text-align:left;" title=""><form method="post" class="input_form" action="scripts/addnewtest.php"><input type="text" name="nameoftest" id="nameoftest" size="30" maxlength="50" /></td>
	<td class="class2"><input type="image" src="images/button_create.gif" style="margin-right:5px;border:0;" alt="View Test"></form></td>
	<td class="class2">&nbsp;</td>
	<td class="class2">&nbsp;</td>
	<td class="class2">&nbsp;</td>
	<td class="class2">&nbsp;</td></tr>


			</table>
	</div>

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