Q:

Sum of Amount for each item in mysql php

I have the code with different items like A,B,C,D and i want to calculate the sum of amount for each item 
 from the below query shows first item's amount whereas i want to get each item sum value
SELECT DISTINCT(itemname),sum(amount) FROM item 

A:

You should try like this:
SELECT SUM(amount)
  FROM table
  GROUP BY id;

