How do I total the values of multiple columns in MySQL?
<p>I'm creating a cart-like tool using php sessions, and I'm already able to add items to a session array using a button. The MySQL table for my items is in the following format:</p>

<pre><code>+----+--------+-------+-----+----------+
| ID |  Name  | Price | Tax | Shipping |  
+----+--------+-------+-----+----------+
|  1 | Apple  |    10 |   2 |        1 |
|  2 | Banana |    20 |   4 |        1 |
|  3 | Orange |    30 |   6 |        2 |
|  4 | Pear   |    40 |   8 |        2 |
+----+--------+-------+-----+----------+
</code></pre>

<p>My goal is to output a list of the item names in the cart, and to list separate totals for price, tax, and shipping.
For example, if I have one apple, one orange, and one pear, my output to the user would be:</p>

<p><strong>CART:</strong> Apple, Orange, Pear<br>
<strong>PRICE:</strong> 80<br>
<strong>TAX:</strong> 16<br>
<strong>SHIPPING:</strong> 5</p>

<p>I'm assuming that I need to create a stored view, but my code so far is just this:</p>

<pre><code>session_start();
$cartitems = implode(',', $_SESSION['items'])
$myconnection = new mysqli('myhost', 'username', 'password', 'mydb', '1234');
$result = $myconnection-&gt;query("SELECT * FROM `my_table` WHERE `id` IN '$cartitems'");
</code></pre>