duanquan4451 2015-08-25 19:10
浏览 62

搜索受百分比和用户类型的限制

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.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
    • ¥15 MATLAB中streamslice问题
    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序