Skip to content

Commit

Permalink
Added touchups to grabAllItems script
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Brown committed Nov 8, 2015
1 parent 47e4e79 commit aa3bc29
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions server/grabAllItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ function readMarketPage($pageNum){

$secCount = 1;
while(true){
//$itemResult = $dom->getElementById('result_' . $secCount . '_name');
$itemResult = $xpath->query("//a//div//span[contains(@id, 'result_" . $secCount . "_name')]");
if($itemResult != false && count($itemResult) > 0 && isset($itemResult->item(0)->nodeValue)){
$itemArray[] = utf8_decode($itemResult->item(0)->nodeValue);
Expand All @@ -61,7 +60,6 @@ function readMarketPage($pageNum){
return $itemArray;
}

// TODO: Remove, redundant to AssistantUtility::fetchSqlData()
function checkItemExistence($item, $sqlConn){
if($sqlConn->errno){
echo $sqlConn->error();
Expand Down Expand Up @@ -94,13 +92,13 @@ function addItemToDatabase($item, $host, $db, $user, $pass){
$update = true;
if(checkItemExistence($item, $sqlConn)){
echo 'Updating ' . $item->name . $lineBreak;
echo '<script>window.scrollTo(0,document.body.scrollHeight);</script>';
//echo '<script>window.scrollTo(0,document.body.scrollHeight);</script>'; // ENABLE IF VIEWING IN WEB BROWSER
$setQuery = "UPDATE items SET current=?, median=?, market=?, volume=? WHERE name=?";
$update = true;

}else{
echo 'Inserting ' . $item->name . $lineBreak;
echo '<script>window.scrollTo(0,document.body.scrollHeight);</script>';
//echo '<script>window.scrollTo(0,document.body.scrollHeight);</script>'; // ENABLE IF VIEWING IN WEB BROWSER
$setQuery = "INSERT INTO items(name, current, median, market, volume) VALUES (?, ?, ?, ?, ?)";
$update = false;
}
Expand Down Expand Up @@ -177,7 +175,7 @@ function grabItemValue($item){


//debug
$lineBreak = "<br/>";
$lineBreak = "\n";
$longestItem = 0;
while(TRUE){
echo 'Page: ' . $count . $lineBreak;
Expand Down

0 comments on commit aa3bc29

Please sign in to comment.