How do I make it when I add a qty number, say that qty number have been added from this date or say have been update qty number from this date?
For example, there are 32 in the database and I add 5 more and that say 5 more were added on this date
source
<?php include_once 'header.php'; ?>
<?php include_once 'sidebar.php'; ?>
<?php include_once 'navtop.php'; ?>
<?php
if ($_SESSION['admin_type'] != "admin") {
header("Location: addPatient.php?add");
}
$del = output(@$_GET['del']);
if(isset($del) && $del!=""){
if(isset($_SESSION['admin_type'])) {
if($_SESSION['admin_type'] == 'admin') {
$stm = $db->prepare("DELETE FROM implant WHERE id=:id");
$stm->bindParam(":id", $del, PDO::PARAM_STR);
$stm->execute();
re("success"," thank you "," deleted successfully. ");
direct("imp_list.php");
}
}
}
?>
<div class="container-fluid">
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-gray-800">Implant System</h6>
</div>
<div class="card-body">
<?php
$stm = $db->prepare("SELECT * FROM implant ORDER BY id ASC");
$stm->execute();
$rowCount = $stm->rowCount();
if($rowCount > 0){
?>
<div class="table-responsive">
<table class="table table-bordered" cellspacing="0" id="datatl">
<thead>
<tr>
<th>#</th>
<th>Type</th>
<th>Quantity</th>
<th>add Quantity</th>
<th>Update Qty Date</th>
<th>Registration Date</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
$nu = 0;
while($row = $stm->fetch(PDO::FETCH_ASSOC)) {
?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['type']; ?></td>
<td>
<?php
if ($row['qty'] <= 5) {
echo '<span class="badge badge-pill badge-danger">'.$row['qty'].' دانە</span>';
}elseif ($row['qty'] > 5 AND $row['qty'] <= 10) {
echo '<span class="badge badge-pill badge-warning">'.$row['qty'].' دانە</span>';
}else {
echo '<span class="badge badge-pill badge-success">'.$row['qty'].' دانە</span>';
}
?>
</td>
<td>
<input type="hidden" class="pid" value="<?= $row['id'] ?>">
<input type="number" class="form-control itemQty" value="<?= $row['qty'] ?>" style="width:75px;">
</td>
<td><?php echo $row['update']; ?></td>
<td><?php echo $row['date_created']; ?></td>
<td>
<a href="edit_implant.php?id=<?php echo htmlentities($row['id']);?>" class="btn btn-warning btn-sm"><i class="fa fa-edit"></i></a>
<a href="imp_list.php?del=<?php echo $row['id']; ?>" class="btn btn-danger btn-sm"><i class="fa fa-trash"></i></a>
</td>
</tr>
<?php $nu++;}?>
</tbody>
</table>
</div>
<?php
}else {
echo 'not avalable';
}
?>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
// Change the item quantity
$(".itemQty").on('change', function() {
var $el = $(this).closest('tr');
var pid = $el.find(".pid").val();
//var pprice = $el.find(".pprice").val();
var qty = $el.find(".itemQty").val();
location.reload(true);
$.ajax({
url: 'action.php',
method: 'post',
cache: false,
data: {
qty: qty,
pid: pid
//pprice: pprice
},
success: function(response) {
console.log(response);
}
});
});
});
</script>
<?php include_once 'footer.php'; ?>