Jump to content

meow20

New Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by meow20

  1. Hi ! please help me . im having a trouble with this im actually new to php. 
    it says Notice: Undefined index: prev in C:\xampp\htdocs\new\viewbill.php on line 21

    Notice: Undefined index: pres in C:\xampp\htdocs\new\viewbill.php on line 22

    Notice: Undefined index: price in C:\xampp\htdocs\new\viewbill.php on line 23

    Notice: Undefined index: id in C:\xampp\htdocs\new\viewbill.php on line 28

     
    <?php
    include 'connection.php';
    $id = $_GET['id'];
    $result = mysql_query("SELECT * FROM meter WHERE reading_id  = '$id'");
     
     
    echo "<table border='1' bgcolor='#fff'>
    <tr>
    <th>Id</th>
    <th>Previous Reading</th>
    <th>Present Reading</th>
    <th>Consuption</th>
    <th>Date</th>
    <th>Bill Amount</th>
    <th>Action</th>
    </tr>";
     
    while($row = mysql_fetch_array($result)){
     
     $prev=$row['prev'];
     $pres=$row['pres'];
     $price=$row['price'];
     $totalcons=$pres - $prev;
     $bill=$totalcons * $price;
     
      echo "<tr>";
      echo "<td>" . $row['id'] . "</td>";
      echo "<td>" . $prev . "</td>";
      echo "<td>" . $pres . "</td>";
      echo "<td>". $totalcons."</td>";
      echo "<td>" . $price . "</td>";
      echo "<td>" . $bill . "</td>";
      echo "</tr>";
      }
      
    echo "</table>";
     
    ?>
     
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.