How do I get a report of this data
There is one ‘Screw’ in the database but it shows two ‘Screw and Cement’. What is the problem?
Is it right to receive a report in this way?
source code
<?php include_once 'header.php'; ?>
<?php include_once 'sidebar.php'; ?>
<?php include_once 'navtop.php'; ?>
<div class="container-fluid">
<?php
$ff=output(@$_GET['ff']);
$ss=output(@$_GET['ss']);
$tyy=output(@$_GET['tyy']);
$fdate=output(@$_GET['fdate']);
$tday=output(@$_GET['tday']);
if (isset($_GET['class'])) {
?>
<div class="card shadow mb-4">
<div class="card-header py-3">
</div>
<div class="card-body">
<form method="get">
<div class="form-group">
<label for="email">Fixation Type:</label>
<select class="form-control" name="ff" id="class_id">
<option value="0" >choose</option>
<option value="Screw">Screw</option>
<option value="Cement">Cement</option>
</select>
</div>
<div class="form-group">
<label for="name">Size:</label>
<input type="text" name="ss" value="" class="form-control" id="student_name" placeholder="Diameter">
</div>
<hr>
<div class="form-group">
<label for="email">Type of crown:</label>
<select class="form-control" name="tyy" id="class_id">
<option value="0" >choose</option>
<option value="ceramic">ceramic</option>
<option value="zirconium">zirconium</option>
<option value="Acrylic">Acrylic</option>
<option value="Emax">Emax</option>
<option value="Veneer">Veneer</option>
<option value="other">other</option>
</select>
</div>
<div class="form-group">
<label>From Date</label>
<input type="text" name="fdate" class="form-control" value="" id="fdate">
</div>
<div class="form-group">
<label>To Date</label>
<input type="text" name="tday" class="form-control" value="" id="tday">
</div>
<div class="form-group" align="center">
<input type="submit" name="class" class="btn btn-primary btn-sm btn-block">
</div>
</form>
<?php
$stm = $db->prepare("SELECT * FROM patient WHERE fixation_t=:ff or Size=:ss or (registration_d between :fdate and :tday AND type_of_c=:tyy)");
$stm->bindParam(":ff",$ff, PDO::PARAM_STR);
$stm->bindParam(":ss",$ss, PDO::PARAM_STR);
$stm->bindParam(":tyy",$tyy, PDO::PARAM_STR);
$stm->bindParam(":fdate",$fdate, PDO::PARAM_STR);
$stm->bindParam(":tday",$tday, PDO::PARAM_STR);
//$stm->bindParam(":sn",$sn, PDO::PARAM_STR);
$stm->execute();
$rowCount = $stm->rowCount();
if($rowCount > 0){
?>
<div class="table-responsive">
<h5 align="center">patient Report from <?php echo $fdate?> to <?php echo $tdate?></h5>
<table class="table table-bordered" id="dataTables-example">
<thead>
<tr>
<th>#</th>
<th>Name</th>
<th>birth</th>
<th>Fixation Type</th>
<th>Doctor</th>
<th>No:Impalnt</th>
<th>Implant System</th>
<th>Cost</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$results=$stm->fetchAll(PDO::FETCH_ASSOC);
$cnt=1;
$total= 0;
foreach ($results as $row) {
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['name']; ?></td>
<td><?php echo $row['birth']; ?></td>
<td><?php echo $row['fixation_t']; ?></td>
<td><?php echo $row['doctor']; ?></td>
<td><?php echo '<span class="badge badge-pill badge-success">Qty '.$row['Impalnt_n'].'</span>'; ?></td>
<td><?php echo $row['type']; ?></td>
<td>$<?php echo $totalmarks=$row['Cost']; ?></td>
<td>
<a href="edit_pateint.php?id=<?php echo htmlentities($row['id']);?>" class="btn btn-warning btn-sm"><i class="fa fa-edit"></i></a>
<a href="patietlist.php?del=<?php echo $row['id']; ?>" class="btn btn-danger btn-sm"><i class="fa fa-trash"></i></a>
</td>
</tr>
<?php
$totlcount+=$totalmarks;
}?>
<tr>
<th scope="row" colspan="7" style="text-align: center">Total Cost</th>
<td colspan="2" style="text-align: left"><b><?php echo htmlentities($totlcount);?></td>
</tr>
<tr>
<th scope="row" colspan="7" style="text-align: center">count</th>
<td colspan="2" style="text-align: left"><b> <?php echo $rowCount; ?></td>
</tr>
</tbody>
</table>
</div>
<?php
} else {
echo 'هیچ ئەنجامێك نەدۆزراوە!';
}
?>
</div>
</div>
<?php } ?>
</div>
<script type="text/javascript">
$('#fromdate').daterangepicker({
singleDatePicker: true,
locale: { format: "YYYY-MM-DD" }
//startDate: moment().subtract(6, 'days')
});
</script>
<script type="text/javascript">
$('#todate').daterangepicker({
singleDatePicker: true,
locale: { format: "YYYY-MM-DD" }
//startDate: moment().subtract(6, 'days')
});
</script>
<?php include_once 'footer.php'; ?>