Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- mysql_connect('localhost','root','');
- mysql_select_db('accounts');
- $sql= "SELECT * FROM users1";
- $list=mysql_query($sql);
- ?>
- <html>
- <head>
- <title>Welcome to ScanNShop</title>
- </head>
- <h1>Welcome to ScanNShop</h1>
- <body>
- <table width="600" border="1" cellpadding="1" cellspacing="1">
- <tr>
- <th>No.</th>
- <th>Name</th>
- <th>Price</th>
- <tr>
- <?php
- while ($users1=mysql_fetch_assoc($list)) {
- echo "<tr>";
- echo "<td>".$users1['pid']."</td>";
- echo "<td>".$users1['name']."</td>";
- echo "<td>".$users1['price']."</td>";
- }
- ?>
- </table>
- </body>
- </html >
- No. Name Price
- 1 bread 2.00
- 2 milk 2.00
- 3 janabab 6797994.00
- 4 jajajsh 846494.00
- mysql_connect('localhost','root','');
- mysql_select_db('accounts');
- $sql= ('SELECT * FROM users1');
- $list=mysql_query($sql);
- ?>
- <html>
- <head>
- <title>Welcome to ScanNShop</title>
- </head>
- <h1>Welcome to ScanNShop</h1>
- <body>
- <table width="600" border="1" cellpadding="1" cellspacing="1">
- <tr>
- <th>No.</th>
- <th>Name</th>
- <th>Price</th>
- </tr>
- <?php
- $total=0;
- while ($users1=mysql_fetch_assoc($list)) {
- echo "<tr>";
- echo "<td>".$users1['pid']."</td>";
- echo "<td>".$users1['name']."</td>";
- echo "<td>".$users1['price']."</td>";
- $total = $users1['price']+$total;
- echo "</tr>";
- }
- echo '<tr><td></td><td>Total:</td><td>'.$total.'</td></tr>';
- ?>
- </table>
- </body>
- </html >
- $sum = 0;
- while ($users1=mysql_fetch_assoc($list)) {
- $sum += $users1['price'];
- echo '<tr>';
- echo '<td>'.$users1['pid'].'</td>';
- echo '<td>'.$users1['name'].'</td>';
- echo '<td>'.$users1['price'].'</td>';
- echo '</tr>';
- }
- echo '<tr>';
- echo '<td></td>';
- echo '<td>Total</td>';
- echo '<td>'.$sum.'</td>';
- echo '<tr>';
- SELECT Number, Min(Name) AS Name, SUM(amount) AS Price
- FROM grocery_list
- GROUP BY Number WITH ROLLUP
- Number Name Price
- 1 bread 2.00
- 2 milk 2.00
- 3 janabab 6797994.00
- 4 jajajsh 846494.00
- NULL bread 7644492.00
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement