Thanks in advance.
$query="delete from `messages` where `messageid` = '$record'";
/// I've tried adding usleep(3000) here as well
$query="select * from `messages` where `to` = '".$_SESSION['profileid']."'";
$_SESSION['messagecount']=$result->num_rows; /// This is the number that should refresh on redirect
Deleting messages ...