while($row = mysql_fetch_row($result)){
preg_match('#<span id="lblNumerZgloszenia" style="font-weight:bold;font-style:italic;">([^<]*)<\/span>#',$row[1],$matches);
$query2 = 'UPDATE content_pl SET kategoria_data='.$matches[1].' WHERE id='.$row[0].';';
mysql_query($query2);
}
我这样做preg_match
是为了将span
内容放入$matches
数组中。当我执行 aprint_r($matches)
时,它会显示正确的结果,但是当我使用时$matches[1]
,它的浏览器会告诉我没有这样的索引。
编辑:print_r
显示
[...]Array ( [0] => TOW: (210) 252250, (220) 01-07-2002 [1] => TOW: (210) 252250, (220) 01-07-2002 ) Array ( [0] => TOW: (210) 252251, (220) 01-07-2002 [1] => TOW: (210) 252251, (220) 01-07-2002 ) Array ( [0] => TOW: (210) 252252, (220) 01-07-2002 [1] => TOW: (210) 252252, (220) 01-07-2002 ) Array ( [0] => TOW: (210) 252253, (220) 01-07-2002 [1] => TOW: (210) 252253, (220) 01-07-2002 )[...]