Prøv dette:
$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);
Eller måske bruges en mere passende kode :
$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);