How do I fix it? – PHP – SitePoint - STRATEGIES TO EARN MONEY

Breaking

Recientes

How do I fix it? – PHP – SitePoint

I have three rows but it shows only one row in report table
what’s the mistake

source code

<?php include_once 'header.php'; ?>
<?php include_once 'sidebar.php'; ?>
<?php include_once 'navtop.php'; ?> <div class="container-fluid"> <?php $student=output(@$_GET['student']); $fix=output(@$_GET['fix']); $type_of_c=output(@$_GET['type_of_c']); $loc=output(@$_GET['loc']); $gen=output(@$_GET['gen']); $fdate=output(@$_GET['fdate']); $tday=output(@$_GET['tday']); $cl=output(@$_GET['cl']); 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="fix" id="class_id"> <option>choose</option> <option value="Screw">Screw</option> <option value="Cement">Cement</option> </select> </div> <div class="form-group"> <label for="email">Type of crown:</label> <select class="form-control" name="type_of_c" id="class_id"> <option>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 for="name">name:</label> <input type="text" name="sn" class="form-control" value="" id="student_name" placeholder="N-Mobile"> <div data-lastpass-icon-root="true" style="position: relative !important; height: 0px !important; width: 0px !important; float: left !important;"></div> </div> <hr> <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" value="Searching" class="btn btn-primary btn-sm btn-block"> </div> </form> <?php $stm = $db->prepare("SELECT name as n, birth as b, Cost as c, count(id) as total FROM patient WHERE fixation_t=:fix or type_of_c=:type_of_c"); //$stm = $db->prepare("SELECT * FROM sub WHERE cl=:class or gr=:gr or sn=:sn or (datee between :fdate and :tday AND cl=:class) "); $stm->bindParam(":fix",$fix, PDO::PARAM_STR); $stm->bindParam(":type_of_c",$type_of_c, PDO::PARAM_STR); //$stm->bindParam(":sn",$sn, PDO::PARAM_STR); //$stm->bindParam(":fdate",$fdate, PDO::PARAM_STR); //$stm->bindParam(":tday",$tday, 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; foreach ($results as $row) { ?> <tr> <td><?php echo $row['id']; ?></td> <td><?php echo $row['n']; ?></td> <td><?php echo $row['b']; ?></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['c']; ?></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="3" 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="3" style="text-align: left"><b> <?php echo $row['total'];?></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'; ?> 

It’s because you are using an aggregate function COUNT(). This will consolidate the result set in to a single row.

What exactly are you trying to count in that query?

Rows The number of rows as shown below

So… let’s take a moment to look at what you’ve got.

You are selecting 4 things: n, b, c, and total.

Here, you expect $row to contain id, n, b, fixation_t, doctor, Implant_n, type, and c.

There’s… quite a bit missing from your query, don’t you think?

Techyrack Website stock market day trading and youtube monetization and adsense Approval

Adsense Arbitrage website traffic Get Adsense Approval Google Adsense Earnings Traffic Arbitrage YouTube Monetization YouTube Monetization, Watchtime and Subscribers Ready Monetized Autoblog



from Web Development – My Blog https://ift.tt/QvOIZf2
via IFTTT

No comments:

Post a Comment

How to earn money