<div class="col-sm-10" id="pageContent"> <h4>Completed Searches</h4> <table class="table table-bordered"> <thead> <th>SL</th> <th>Name </th> <th>Date</th> <th>Action</th> </thead> <tbody> <?php $count = 1; $results = $us->getCompletedSearches(); foreach ($results as $row) { if ($row['date'] == "0000-00-00 00:00:00") { $date = date("d-m-Y H:i:s"); } else { $date = strtotime($row['date']); $date = date('d-m-Y H:i:s', $date); } $row["Name"] = preg_replace("@\\_@", " ", $row['Name']); echo '<tr><td>' . $count . '</td><td>' . $row['Name'] . '</td><td>' . $date . '</td><td><a href="download.php?id=' . $row['SearchID'] . '">Download Report</a></td></tr>'; $count++; } ?> </tbody> </table>