<?php
function pojava_reci_dokument($rec,$dokument)
{
    $con= mysqli_connect("localhost","tagstudi_aldina","aldina1234567","tagstudi_dokumenta");
$result = mysqli_query($con,"SELECT sum(br_poj) as br_poj,rec FROM recenica_reci
WHERE id_dokumenta=$dokument and rec='$rec'");
while($row = mysqli_fetch_array($result))
  {
  $m= $row['br_poj'];
  }
return $m;
}
//$a=pojava_reci_dokument('razli',1001);
// echo $a;
?>