I want to add 2 rows of a table having numbers in that and I want that sum of 2 rows in a new row of the table
I wrote my code using sql query..
<?php
$con = mysqli_connect("localhost", "root", "", "project");
if(!$con) {
die('not connected');
}
$con = mysqli_query($con, "SELECT addplace, stayamount, foodamount, airlinesamount, noofdays, totalamount AS sum(stayamount + foodamount + airlinesamount) choose FROM adddetails");
?>
<div class="container">
<center><h2>view packages</h2></center>
<table class="table table-bordered">
<th>place</th>
<th>stay cost</th>
<th>food cost</th>
<th>flight cost</th>
<th>no of days</th>
<th>total amount</th>
<th>image</th>
<?php while($row = mysqli_fetch_array($con, MYSQLI_ASSOC)) { ?>
<tr>
<td><?php echo $row['addplace']; ?></td>
<td><?php echo $row['stayamount']; ?></td>
<td><?php echo $row['foodamount'] ;?></td>
<td><?php echo $row['airlinesamount'] ;?></td>
<td><?php echo $row['noofdays'] ;?></td>
<td><?php echo $row['totalamount'] ;?></td>
<td><?php echo $row['choose'] ;?></td>
</tr>
<?php } ?>
</table>
</div>
and I am getting an error.
Can any one rewrite my sql
query or php
to add 2 rows containing numbers and I want the sum of that rows in a new row
[database image in phpmyadmin ][1]
[my table in my web page (image)][2]
Thanking You
code for image
<input name="choose" class="form-control" type="file" >
i want the selected image to be displyed in my website as full image,nt the name of the image what should i do..
[in chose row the image is stored][3]