Creating hyper links for database query results.

Hi,
I have created a query to fetch summary report of my test cases.

The reports provides the following data.

Date ---- Total ------ Passed ------- Failed ------ Not run
xxx xx xx xx xx

I now want to create a hyper link for failed testcases field so that by clicking on that failed test case numbers the user is presented with a detailed list of all failed test cases.

Can some one help me on this.

Thanks
Krishna

Hello,
If I understand you correctly, what you are looking for would be something like the following…

<a href="testcases.php?status=failed" target="_blank"> Failed </a>

testcases.php page would look something like -->
[php]<?
//-- This pulls the value of the variable status in the URL.
$status = $_GET[‘status’];

//-- Selecting appropriate information based on the variable passed in the URL
$q = “SELECT * FROM tbltestcases WHERE status = ‘$status’”;
$r = mysql_query($q) or die("ERROR GETTING DATA. REASON: " . mysql_error());

while($row = mysql_fetch_array($r))
{
//OUTPUT YOUR INFORMATION HERE
}?>[/php]

This is probably a lot more information than what was needed, or maybe not even what you were trying to achive, just going off of what I understood by they question.

Hope it helps!

Sponsor our Newsletter | Privacy Policy | Terms of Service