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);
}
I'm doing this preg_match
to get the span
contents into $matches
array.
When I do a print_r($matches)
, it shows the right results but when I use $matches[1]
, it browser tells me that there is no such index.
EDIT: print_r
shows
[...]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 )[...]