Location: PHPKode > projects > Druid Defect Control > defectcontrol_0.9.4/tts/querybysamplepost.php
<?php require_once 'usercheck.php' ?>
<?php 
  require_once 'storedqueries_data.php'; 
  require_once 'database.php';
?>

<html>
<head>
<title>Query result</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="style.css">
</head>
<body bgcolor="#FFFFFF">
<?php include 'header.php'; ?>

<h1>Query results</h1>

<p>
<?php 

    $query = "SELECT DISTINCT d.iid as defectid, d.sheadline as headline, ".
             "d.ddetectdate as detectiondate, u.sname as submitter, ".
             "s.sname as status, p.sname as priority ".
        "FROM defect d, defectstatus s, priority p, users u, enclosure e ".
        "WHERE  d.iidsubmitter = u.iid AND d.iiddefectstatus = s.iid AND ".
        "d.iidpriority = p.iid AND e.iiddefect = d.iid ";

    if ($fDefectId != "") $query .= " AND d.iid = $fDefectId"; 
    
    // FIXME: apparently upper() is available in MYSQL, but how about other backends?

    if ($fHeadline != "") $query .= " AND upper(d.sheadline) like '%".strtoupper($fHeadline)."%'";
    if ($fEnclosureTitle != "") $query .= " AND upper(e.stitle) like '%".strtoupper($fEnclosureTitle)."%'";
    if ($fEnclosureText != "") $query .= " AND upper(e.stext) like '%".strtoupper($fEnclosureText)."%'";
    if ($fStatus != "null") $query .= " AND d.iiddefectstatus = $fStatus";
    if ($fCreatedBy != "null") $query .= " AND d.iidsubmitter = $fCreatedBy";
    if ($fAssignedTo != "null") $query .= " AND d.iidassigned = $fAssignedTo";
    if ($fProject != "null") $query .= " AND d.iidproject = $fProject";
    if ($fSoftware != "null") $query .= " AND d.iidsoftware = $fSoftware";
    if ($fDetectedInRelease != "null") $query .= " AND d.iiddetectedinrelease = $fDetectedInRelease";
    if ($fIntegratedOnRelease != "null") $query .= " AND d.iidintegratedinrelease = $fIntegratedOnRelease";
    if ($fRepeat != "null") $query .= " AND d.iidrepeat = $fRepeat";
    if ($fDefectType != "null") $query .= " AND d.iiddefecttype = $fDefectType";    
    if ($fDetectionMethod != "null") $query .= " AND d.iiddetectionmethod = $fDetectionMethod";    
    if ($fPriority != "null") $query .= " AND d.iidpriority = $fPriority";
    if ($fResolutionType != "null") $query .= " AND d.iidresolutiontype = $fResolutionType";    

    // FIXME: also have to check date input format for conditions in MYSQL
    
    if ($fCreatedAfter != "") $query .= " AND d.ddetectdate >= '$fCreatedAfter'";
    if ($fCreatedBefore != "") $query .= " AND d.ddetectdate <= '$fCreatedBefore'";



    $query .= " ORDER BY defectid";

    //echo $query;

?>


<?php 
	$tts_query = $query; 
	include 'queryresult.php'; 
?>


<p>&nbsp;</p>
<?php include 'footer.php'; ?>
</body>
</html>
Return current item: Druid Defect Control