meow20 Posted December 4, 2014 Share Posted December 4, 2014 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 22Notice: Undefined index: price in C:\xampp\htdocs\new\viewbill.php on line 23Notice: 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>"; ?> Quote Link to comment Share on other sites More sharing options...
Ch0cu3r Posted December 4, 2014 Share Posted December 4, 2014 Have you got columns actually named as prev, pres, price and id within that table? Could you post your table structure? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.