Working on classifieds website project and using and open source framework "osclass", i'm trying to load Every category count with AJAX api call, but sometimes it do not return accurate results
Example: Total active cars in database: 71 but API returns 68
after refreshing the chrome cache i get exact number:
here is my simple API code:
$result = $con->query("SELECT pk_i_id FROM oc_t_item where pk_i_id in (select fk_i_item_id from oc_t_item_location where fk_i_region_id=$id) and fk_i_category_id=$cat and dt_expiration >= now() and b_enabled=1 and b_active=1") or die(mysql_error());
$count= mysqli_num_rows($result);
$array = mysqli_fetch_row($result);
}
else{
$result = $con->query("SELECT pk_i_id FROM oc_t_item where fk_i_category_id=$cat and dt_expiration >= now() and b_enabled=1 and b_active=1") or die(mysql_error());
$count= mysqli_num_rows($result);enter code here
$array = mysqli_fetch_row($result);
}
echo json_encode($count);
I think its cache related issue but i dont know how to deal with that issue, Help would be appreciated!