<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
require_once ('../includes/connect.php');
try {
$filter = $db->query("SELECT * FROM table");
$check = $filter->rowCount();
echo $check.'<br />';
for($i = 1; $i < $check+1; $i++){
$c = $filter->fetch();
//echo $c['ID'];
$source = file_get_contents($c['pURLMorele']);
$dom = new DOMDocument();
@$dom->loadHTML($source);
$xpath = new DOMXPath($dom);
$rows = $xpath->query("//span[@class='price']");
print_r($rows->item(0)->textContent);
}
}
catch (PDOException $e) {
echo 'Something went wrong!<br>'.$e->getMessage();
die();
}
?>
在我的数据库中有4条记录,但我不知道它为什么只显示其中的3条(2,3,4)。哪里是1?!
这是我的输出:
4
Notice: Trying to get property of non-object in /var/www/vhosts/20/147910/webspace/httpdocs/serwer151299580.twojeaz.pl/functions/pricesUpdate.php on line 19
515,00 zł 269,00 zł 1589,00 zł
答案 0 :(得分:0)
您可以尝试更改:
googlesearch_settings.py
到
for($i = 1; $i < $check+1; $i++){
$c = $filter->fetch();
这样你就不会超出资源的界限。