0
<table width="700" border="1" bordercolor="#FFFFFF" bgcolor="#000000">
          <tr bgcolor="#FFFF66">
            <td height="28" colspan="3" align="center"><strong> My Blood Pressure Data</strong></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td>Date:</td>
            <td>:</td>
            <td><?php echo $row["date"];?></td>
            </tr>

          <tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
            <td width="170">Select a time(12Hours)</td>
            <td width="3">:</td>
            <td><?php echo $row["time"]; ?></td>    
          </tr>
          <tr bordercolor="#FFFFFF" bgcolor="#FFFFFF">
            <td>Systolic mm Hg</td>
            <td>:</td>
            <td><?php echo $row["systolic"]; ?>

            </td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td>Diastolic mm Hg</td>
            <td>:</td>
            <td><?php echo $row["diastolic"]; ?>
              </td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td>Pulse</td>
            <td>:</td>
            <td><?php echo $row["pulse"]; ?></td>
          </tr>
          <?php

            $systolic= "systolic";
            $diastolic= "diastolic";

            $select=@mysql_query("SELECT systolic, diastolic FROM blood_record");
            $info=@mysql_fetch_array($select, $conn);
            if($info)
            {
                if($systolic < 120 AND $diastolic < 80)
                {
                    $level = "NORMAL";
                }
                else if($systolic >120 && $systolic <139 AND $diastolic >80 && $diastolic <89)
                {
                    $level = "AT RISK";
                }
                else if($systolic >140 AND $diastolic >90)
                {
                    $level = "HIGH";
                }
                else
                {   
                    $level = "nothing";
                }
            }
          ?>
          <tr bgcolor="#FFFFFF">
            <td>Blood Pressure Level</td>
            <td>:</td>
            <td><?php echo $level; ?></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td>Patient's Name</td>
            <td>:</td>
            <td><?php echo $row["name"]; ?></td>
          </tr>
          <tr bgcolor="#FFFFFF">
            <td height="28">Comment</td>
            <td>:</td>
            <td><?php echo $row["comment"]; ?>
</td>
          </tr>

        </table>

so basically my error has something to do with the php code. error displayed is undefined index for <?php echo $level?> id like to know what i did wrong and/or improvement in my php code especially the else if statements. thanks in advance.

2
Contributors
1
Reply
24
Views
3 Years
Discussion Span
Last Post by PsychicTide
0

Why do you define $systolic="systolic" and $diastolic="diastolic" before the query?

Are you sure you're getting a result from the $info=@mysql_fetch_array($select, $conn) ?

Edited by PsychicTide

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.