$stmt = mysqli_prepare($link,"
SELECT *
FROM ads
INNER JOIN dept ON dept.id_dept = ads.in_dpt
INNER JOIN members ON members.idMem = ads.from_Mem
INNER JOIN sub_cat_ad ON id_sub_cat = ads.ads_in_Cat
INNER JOIN cat_ad ON idCat_ad = sub_cat_ad.from_cat_ad
WHERE ads_in_Cat = ? ");
if(isset($_GET['fromSCat'])){
$fromSCat = mysqli_real_escape_string($link,$_GET['fromSCat']);
}
mysqli_stmt_bind_param($stmt,'i',$fromSCat);
mysqli_stmt_execute($stmt);
mysqli_stmt_fetch($stmt);
$tot=mysqli_stmt_num_rows($stmt); //Ouput: 0
Without the prepared statement, it's ok