Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <link rel="stylesheet"
- href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
- </head>
- <body>
- <div class="content" align="center">
- <form action="#" method="post">
- <div class="input-group">
- <input type="text" name="uid" placeholder="Enter Username">
- </div>
- <br>
- <div class="input-group">
- <button type="submit" class="btn" name="sprescription">Search Prescription</button>
- </div>
- <br>
- </form>
- <form action="dindex.php">
- <div class="input-group">
- <button type="submit" class="btn" name="back">Back</button>
- </div>
- </form>
- <?php
- if(session_id() == ''){
- //session has not started
- session_start();
- }
- $uid=$_POST['uid'];
- $uid=(int)$uid;
- //error_reporting(0);
- // Import the file where we defined the connection to Database.
- require_once "connection.php";
- $limit = 10; // Number of entries to show in a page.
- // Look for a GET variable page if not found default is 1.
- if (isset($_GET["page"])) {
- $pn = $_GET["page"];
- }
- else {
- $pn=1;
- };
- $start_from = ($pn-1) * $limit;
- $sql = "SELECT * FROM prescription WHERE pid='$uid' ORDER BY date DESC LIMIT $start_from, $limit";
- $rs_result = mysqli_query ($conn,$sql);
- ?>
- <div class="container">
- <br>
- <div>
- <h1>Prescription</h1>
- <table class="table table-striped table-condensed table-bordered">
- <thead>
- <tr>
- <th>Id</th>
- <th>Medicine Name</th>
- <th>Medicine Date</th>
- <th>Doctor Id</th>
- <th>Patient Id</th>
- <th>Time</th>
- <th>Timeline</th>
- </tr>
- </thead>
- <tbody>
- <?php
- while ($row = mysqli_fetch_array($rs_result, MYSQLI_ASSOC)) {
- // Display each field of the records.
- ?>
- <tr>
- <td><?php echo $row["id"]; ?></td>
- <td><?php echo $row["mname"]; ?></td>
- <td><?php echo $row["date"]; ?></td>
- <td><?php echo $row["did"]; ?></td>
- <td><?php echo $row["pid"]; ?></td>
- <td><?php echo $row["time"]; ?></td>
- <td><?php echo $row["timeline"]; ?></td>
- </tr>
- <?php
- };
- ?>
- </tbody>
- </table>
- <ul class="pagination">
- <?php
- $sql = "SELECT COUNT(*) FROM prescription";
- $rs_result = mysqli_query($conn,$sql);
- $row = mysqli_fetch_row($rs_result);
- $total_records = $row[0];
- // Number of pages required.
- $total_pages = ceil($total_records / $limit);
- $pagLink = "";
- for ($i=1; $i<=$total_pages; $i++) {
- if ($i==$pn) {
- $pagLink .= "<li class='active'><a href='index.php?page="
- .$i."'>".$i."</a></li>";
- }
- else {
- $pagLink .= "<li><a href='index.php?page=".$i."'>
- ".$i."</a></li>";
- }
- };
- echo $pagLink;
- ?>
- </ul>
- </div>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement