since you are selecting AS total, it would be $row['total']
not sure what the problem is, do you have access to phpMyAdmin, if so take the select statement and paste it into it and run the sql to see if it works that way
the syntax is correct that i gave, just not sure what the problem is