I am starting a project where I need to do a search based on user type and ranking. If the user have the free plan it only appears in 40% of searches and as the best ranking. To search by ranking I think it's not tricky! But what to do to the search show the free users only 40% of searches?I looked at Oracle and here too, out 43 other websites and found nothing about it. Anyone know of any link or have any idea how to do? Thank you and taking advantage, congratulations to us by 10 million questions! :)
EDIT: (guess this is the way)
$query = "SELECT COUNT(*) FROM users WHERE user_type = 'silver'";
$result = mysqli_query($connection,$query);
$row = mysqli_fetch_row($result));
$total = $row[0];
$percent = intval($total * 0.40);
$query = "SELECT * FROM users WHERE user_type = 'silver' ORDER BY RAND() LIMIT ". $percent;
Okay. Theoretically this will give me 40% of silver users every search. But then I ask: is that correct? The proposal is that the silver users appear in 40% OF TOTAL SEARCHES and not 40% of the total silver entries.