mysql 데이터베이스를 업데이트하는 데 문제가 있습니다. ~ 800,000 행 데이터베이스에서이 스크립트를 실행하고 싶지만 LIMIT에 +5를 추가하여이 mysql 쿼리를 자동으로 업데이트해야하는 경우 5 개 행 이후에 메모리가 부족합니다. 메모리 문제 mysql
내가 리디렉션을 사용하거나 어떻게 든 메모리를 재설정 할
..<?php
include(dirname(__FILE__) .'/include/simple_html_dom.php');
mysql_connect('localhost', '', '');
mysql_select_db('');
$result = mysql_query("SELECT gamertag FROM gamertags LIMIT 0, 5 ");
while ($row = mysql_fetch_assoc($result)) {
$gamertag = $row['gamertag'];
//pages to pull stats from
$site_url = 'http://www.bungie.net';
$stats_page = 'http://www.bungie.net/stats/reach/default.aspx?player=';
//create dom
$html = new simple_html_dom();
$html->load_file($stats_page . urlencode(strtolower($gamertag)));
//pull nameplate emblem url, ****if it exist****
$nameplate_emblem_el = $html->find("#ctl00_mainContent_identityBar_namePlateImg");
if (!$nameplate_emblem_el){
$nameplate_emblem = 'No nameplate emblem!';
}
else{
//only if #ctl00_mainContent_identityBar_namePlateImg is found
$nameplate_emblem = htmlspecialchars_decode($nameplate_emblem_el[0]->attr['src']);
$nameplate_emblem = $site_url . $nameplate_emblem;
}
mysql_query("INSERT IGNORE INTO star SET gamertag = '".$gamertag."',nameplate = '".$nameplate_emblem."'");
}
?>
왜 선택해야합니까? 모두 800,000 행? 그냥 호기심. 만약 당신이 그들 모두를 어떻게 든 그것을 쿼리를 통해 할 수 없을 것이라고 업데이 트해야합니까? –
메모리를 사용하는 것을 볼 수 있도록 더 많은 코드를 보여 주어야합니다. – Unicron
스크립트의 나머지 부분을 보여 주거나이 목적을 설명해주십시오. 게이머 태그 만 필요하면 mysql_fetch_row()가 더 빠르며 리소스 소모가 적습니다. – guillaumepotier