Search the Community
Showing results for tags 'last'.
-
I have been struggling for a few days on this one and don't know what to search for to get the answers I'm looking for. I would like to be able to pull up the last entries of individual products in an inventory table. I already have things so the product names are uniform (product column) and that it has a currently updated total. What I want is for my users to be able to go to a page that pulls up only the last entries for each individual product. (not the whole database). The following brings up everything. But I'm looking for a quick page where it only looks for the total (tot) of the most recent entry of EACH unique product. This way products can be added through a dropdown populated by another table. $sql = "SELECT * FROM inventory"; if(!$result = $db->query($sql)){ die('There was an error running the query [' . $db->error . ']'); } echo "<table style='border: 2px;font-family: tahoma;'><caption><b>Entire Database Contents</b></caption><tr><td>ID</td><td>Time Stamp</td><td>Staff</td><td>Client</td><td>Needed</td><td>Product</td><td>Amount</td><td>Totals</td><td style='width: 200px;'>Comments</td></tr>"; while($row = $result->fetch_assoc()){ echo '<td>' . $row['id'] . '</td>'; echo '<td>' . $row['timeStamp'] . '</td>'; echo '<td>' . $row['staff'] . '</td>'; echo '<td>' . $row['client'] . '</td>'; echo '<td>' . $row['dateNeeded'] . '</td>'; echo '<td>' . $row['product'] . '</td>'; echo '<td>' . $row['amt'] . '</td>'; echo '<td>' . $row['tot'] . '</td>'; echo '<td>' . $row['comments'] . '</td></tr>'; } echo "</table>"; thanks!