All the text between the two " " expect the $variables are interpreted and echoed as text.
This leads to your echo result > the script runs as it should !
$hitsout is empty or uninitialized and in this case 0.
try: $total = $hitsout / 12;
then echo it: echo($total);
Cheers
jb