Det lykkedes mig at finde ud af det, jeg vil detaljere mit svar nedenfor for alle, der er interesseret i fremtiden.
Original kode
$query="select SQL_CALC_FOUND_ROWS id,title,location,salary,employer from jobs where region=38 limit 0,3";
if($stmt = $connection->prepare($query)) {
$stmt->execute()or die($connection->error); //execute query
$stmt->bind_result($id,$title,$location,$salary,$employer,$image);
while($stmt->fetch()){
$jobs[$x]['id']=$id;
$jobs[$x]['title']=$title;
$jobs[$x]['location']=$location;
$jobs[$x]['salary']=$salary;
$jobs[$x]['employer']=$employer;
$jobs[$x]['image']=$image;
$x++;
}
$stmt->close();//close statement
}
Opdateret kode
$query="select SQL_CALC_FOUND_ROWS id,title,location,salary,employer from jobs where region=38 limit 0,3";
if($stmt = $connection->prepare($query)) {
$stmt->execute()or die($connection->error); //execute query
$stmt->bind_result($id,$title,$location,$salary,$employer,$image);
while($stmt->fetch()){
$jobs[$x]['id']=$id;
$jobs[$x]['title']=$title;
$jobs[$x]['location']=$location;
$jobs[$x]['salary']=$salary;
$jobs[$x]['employer']=$employer;
$jobs[$x]['image']=$image;
$x++;
}
//get total number of rows.
$query="SELECT FOUND_ROWS()";
$stmt = $connection->prepare($query);
$stmt->execute();
$stmt->bind_result($num);
while($stmt->fetch()){
$count=$num;
}
$stmt->close();//close statement
}
Kunne sikkert gøre det bedre på en anden måde, men jeg kunne ikke finde nogle gode eksempler nogen steder på nettet, og det virker!