Add use strict and use warnings to your script as I can see mistakes like \$total then $Total used later. Also, why are you passing undef as the first argument to bind? Also, you can just use fetch when columns are bound and not fetchrow_array.
There is something perculiar about your trace. fetchrow_array should return undef if there are no rows but yours is returning '0'. I think you are using scalar context on fetchrow_array and your first or last column is 0. Switch to just calling fetch and the problem should go away.