Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- header('Content-Type: application/json');
- $servername = "localhost";
- $username = "miiskyroot";
- $password = "miisky@123";
- $dbname = "miisky123";
- // Create connection
- $conn = new mysqli($servername, $username, $password, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT device_sim_no FROM svasth_registration WHERE vault_no = '" . $_SESSION['vault_no'] . "' order by id desc LIMIT 1";
- $result = $conn->query($sql);
- if ($result->num_rows > 0)
- {
- // output data of each row
- while($row = $result->fetch_assoc())
- {
- // echo "<div class='row'>
- // <h4 style='color:#8a1919;' class='col-sm-3'>Device Sim No: ".$row['device_sim_no']." </h4>
- // </div>";
- $simdis=$row['device_sim_no'];
- //echo $simdis;
- }
- }
- else
- {
- echo "You have not registered with Svasth+ ";
- }
- if (!empty($simdis)) {
- $indiatimezone = new DateTimeZone("Asia/Kolkata" );
- $date = new DateTime();
- $date->setTimezone($indiatimezone);
- $dt1=$date->format( 'jS M Y' );
- //$sql_2 = "SELECT breakfast,lunch,dinner,medicines,insulin,accucheck FROM meals_timings WHERE vault_no = '" . $_SESSION['vault_no'] . "' order by id desc limit 1";
- //echo $sql_2;
- $sql_2 = "SELECT DATE_FORMAT( current_date_time, '%H:00 %p' ) TIMEONLY, diabetes, sim_no
- FROM svasth_connect
- WHERE sim_no
- IN (
- SELECT device_sim_no
- FROM svasth_registration
- WHERE vault_no = '" . $_SESSION['vault_no'] . "'
- )and temp NOT
- IN (
- ''
- )
- ORDER BY id DESC LIMIT 10";
- $result_2 = $conn->query($sql_2);
- if ($result_2->num_rows > 0)
- {
- echo "<table class='table table-bordered'>
- <thead>
- <tr>
- <th> TIME </th>
- <th>DIABETES - MG/DL</th>
- <th style='display:none;'> Device No </th>
- </tr>
- </thead>";
- echo "<h3 style='color:#8a1919;' class='col-sm-6'> Date: ".$dt1." </h3>";
- // echo "<h3 style='color:#8a1919;' class='col-sm-3'> Last 10 Readings </h3>";
- echo "<h3 style='color:#8a1919;' class='col-sm-6'> Prescribed Readings: 80-140 (Mg/Dl) </h3>";
- // output data of each row
- while($row = $result_2->fetch_assoc())
- {
- echo "<tr>";
- echo "<td>" . $row['TIMEONLY'] . "</td>";
- if($row['diabetes']<"80" || $row['diabetes']>"140") // [val2]can be 'rejected'
- echo "<td style='background-color: #FF0000; color: white;'><b>".$row['diabetes']."</b></td>";
- else// [val1] can be 'approved'
- echo "<td>".$row['diabetes']."</td>";
- //echo "<td>" . $row['diabetes'] . "</td>";
- //echo "<td>" . $row['sim_no'] . "</td>";
- echo "</tr>";
- }
- echo "</table>";
- }
- else
- {
- echo "No data found";
- }
- }
- $conn->close();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement