2
일부 데이터를 xpath로 긁어 내서 SQL에 삽입하려고합니다.루프 된 데이터를 SQL에 삽입
Echo는 정상적으로 작동하지만 SQL에 삽입 할 때 첫 번째 행만 가져옵니다.
예 :
<?php
$res=mysql_query("SELECT table.title, table.link FROM table WHERE table.link LIKE 'http://www.%' AND streams.title = ''");
while($row=mysql_fetch_array($res))
{
$html = new DOMDocument();
@$html->loadHtmlFile($row["link"]);
$xpath = new DOMXPath($html);
foreach ($xpath->query("//table[@style='margin-left: 5px;']//td[@width='150']//a") as $files)
{
$html = new DOMDocument();
@$html->loadHtmlFile($files->getAttribute('href'));
$xpath = new DOMXPath($html);
$hl = $xpath->query("//div[@style='width:742px']/a[preceding-sibling::div[@id='help1']]/@href")->item(0)->nodeValue;
$link=serialize(array('link' => $hl));
$link=sqlesc($link);
echo $link; // all lines gets printed, thats okay?
mysql_query("UPDATE streams SET streams.hl=$link") or die(mysql_error()); // Only first line gets inserted, why?
}
}
?>
이 업데이트 한 Statment가없는 테이블에서 다른 비 선택적인 열이있는 경우이
을 시도 삽입이 값을 삽입 할 경우
, 문제는 ... –
나는 또한 어디 clausule와 함께 노력하고 여전히 문제가 있습니다. – user1846022