Опитайте това:
$b= mysql_query("SELECT bobot FROM atribut where id= 1");
$row = mysql_fetch_row($b);
$b = $row[0];
$d= mysql_query("SELECT bobot FROM atribut where id= 2");
$row = mysql_fetch_row($d);
$d = $row[0];
[...] // repeat for $f and $h
$calc = $b + $d + $f + $h;
echo($calc);
Или може би е използван по-подходящ код :
$b= mysql_query("SELECT SUM(bobot) as calc FROM atribut WHERE id IN (1,2,3,4)");
$row = mysql_fetch_row($b);
$calc = $row[0];
echo($calc);