Hey Guys finally problem solve after 3 cups of coffee:))
for anyone out there that face or in the future will face the same issues as me and give up trying to make it work inside the query itself you can just put the computation inside the while loop like this and echo the total amount. simple as that yet took me almost 3hrs..:((
while($rows = mysql_fetch_assoc($query))
{
$total += $rows['Grand_total'];
}