duanhan8757 2017-03-11 16:24
浏览 14

我的视频ID超过46,000,将使用我的数据库记录(大约10,000)进行搜索。 如果存在则该id将存储在数组中

I have video id more than 46,000 which will be searching with my database records (about 10,000). If exist then this id will be stored in a array . I have created a php script to do that but it is take more than 50sec and with a high pressure on my laptop running WAMP. I think there are many algorithm on searching to do such work. I want to know if there any alternative faster way to do that. My code is attached below. Thanks

$query = "SELECT video_id,title FROM `all_videos`";
$res = mysql_query($query);
ini_set('max_execution_time', 300); //300 seconds = 5 minutes
while ($row = mysql_fetch_row($res)) {
    $b = array_search($row[0], $arr);  // Searching video id from $arr - array..
    if ($b != '' or $b === 0) // Matching..
    {
        echo 'Match Found!! => ' . $row[0] . ' || ' . $row[1] . '<hr>';
        $del[$i] = $row[0];
        $i++;
    }

}
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
    • ¥20 关于URL获取的参数,无法执行二选一查询
    • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
    • ¥15 marlin编译错误,如何解决?
    • ¥15 有偿四位数,节约算法和扫描算法
    • ¥15 VUE项目怎么运行,系统打不开
    • ¥50 pointpillars等目标检测算法怎么融合注意力机制
    • ¥20 Vs code Mac系统 PHP Debug调试环境配置
    • ¥60 大一项目课,微信小程序
    • ¥15 求视频摘要youtube和ovp数据集