http://www.koolfree.com/ImageUpload/uploads/1340729929.jpg (Table Image)
Hello, I have linked to an Image (because stackoverflow was not allowing me to upload due to less than 10 reputation) in which you can see there is a Table with 9 Columns and 3 Rows and the Table is connected to the Database and all the values in the table are stored in the Database.
As you can see there is a Last Column of Total in which I want to display the Multiplication Result of Days and Salary values individually Row-wise.
E.g.
user456 has worked 30 Days and his Salary is 100, so it should multiply 30 by 100 and generate the result i.e. 3000 and the result should be displayed in Last Column of Total <>amount.
Similarly,
user123 has worked 30 Days and his Salary is 250, so it should multiply 30 by 250 and generate the result i.e. 7500 and the result should be displayed in Last Column of Total <>amount.
I have used the following code in the Table and sharing for your assistance.
<?php
/*
VIEW.PHP
Displays all data from 'accounts' table
*/
// connect to the database
include('connect-db.php');
// get results from database
$result = mysql_query("SELECT * FROM accounts")
or die(mysql_error());
// display data in table
echo "<p><b>View All</b> | <a href='view-paginated.php?page=1'>View Paginated</a></p>";
echo "<table border='1' cellpadding='10'>";
echo "<tr> <th>No</th> <th>Name & ID</th> <th>Days</th> <th>OverTime</th> <th>Date</th> <th>Salary</th> <th>Edit</th><th>Delete</th><th>Total</th></tr>";
// loop through results of database query, displaying them in the table
while($row = mysql_fetch_array( $result )) {
// echo out the contents of each row into a table
echo "<tr>";
echo '<td>' . $row['id'] . '</td>';
echo '<td>' . $row['keywords'] . '</td>';
echo '<td>' . $row['title'] . '</td>';
echo '<td>' . $row['description'] . '</td>';
echo '<td>' . $row['date'] . '</td>';
echo '<td>' . $row['salary'] . '</td>';
echo '<td><a href="edit.php?id=' . $row['id'] . '">Edit</a></td>';
echo '<td><a href="delete.php?id=' . $row['id'] . '">Delete</a></td>';
echo '<td><>amount</a></td>';
echo "</tr>";
}
// close table>
echo "</table>";
?>
Kindly tell me what additions or changes should I made to the codes to generate the requisite result?
http://www.koolfree.com/ImageUpload/uploads/1341093148.jpg
I have attached a link of Screenshot. Kindly see the Screenshot and tell me how can I add multiple jobs per user ID?