JezK
Edit File: myproducts.php
<?php include('userObject.php'); $result = $user->getMyProducts($_POST); $getDataCount = $result['count']; if ($getDataCount > 0) { $data = array(); $data1 = ''; $data2 = ''; foreach ($result['myproducts'] as $row) { $dateString = $row['created_date']; $dateTime = new DateTime($dateString); $convertedDate = $dateTime->format('d-m-Y'); if($row['productExpiry'] == 0){ $expiry = ''; }else{ if($row['productDuration'] == 1){ $duration = 'Months'; }else{ $duration = 'Years'; } $expiry = 'Expiry: '.$row['productExpiry'].' '. $duration; } if($row['productWarrenty'] == 0){ $warranty = ''; }else{ if($row['productWarrentyDuration'] == 1){ $warranty_duration = 'Months'; }else{ $warranty_duration = 'Years'; } $warranty = 'Warranty: '.$row['productWarrenty'].' '. $warranty_duration; } $data[] = '<div class="col-sm-6 col-md-4"> <div class="product-box"> <a href="' . getenv('BASE_URL') . 'App/userInvoicepdf.php?allotmentId=' . $row['id'] . '" class="" style="width: 10%;" data-toggle="tooltip" title="Download Invoice" data-bs-original-title="Download Invoice" data-bs-html="true" data-bs-boundary="viewport" data-bs-container="body" data-bs-placement="top" data-bs-custom-class="tooltip-sm"> <i class="fa fa-download" aria-hidden="true" style="font-size: 1.4em; top: 20px; right: 10px;"></i> </a> <div class="row"> <div class="col-md-12"> <p class="product-quantity"> ' . $row['quantity'] . ' </p> <div class="d-flex justify-content-center"> <img src="./uploads/products/' . $row['image'] . '" class="img-fluid de-images" /> </div> <p class="pd-title"> ' . $row['productName'] . '</p> </div> </div> <div class="package-name"> <p class="product-price"> <span class="text-dark">Purchased on: </span>' . $convertedDate . ' </p> <p class="product-price"> Rs.' . $row['cost'] . ' </p> <p class="product-desc"> '.$expiry.'<br> '.$warranty.' </p> </div> </div> </div>'; } $k = count($data); $i = intval($_POST['offset']); $j = intval($_POST['limit']); $j = $i + $j; if ($j > $k) { $j = $k; } while ($i < $j) { $data2 .= $data[$i]; $i++; } // print_r($data2);exit; $data1 = json_encode(array("myproductData" => $data2, "count" => $result['count'])); }else{ $data1 = json_encode(array("myproductData" => "You Haven't Purchased any thing!", "count" => $result['count'])); } echo $data1;