$filebase = "news"; $num_records = 10; $SQL = "SELECT * FROM $content_table WHERE contenttype = 'video' ORDER BY dateadded DESC, ID DESC"; for ($n=1; $n<=$num_records; $n++) { $pointer = $sth->fetchrow_hashref; $title = $pointer->{'title'}; $main_list2 = $main_list2 . "$title"; print outfile1 "$main_list2"; } $filebase = "morenews"; $num_records = 40; for ($n=1; $n<=$num_records; $n++) { $pointer = $sth->fetchrow_hashref; $title = $pointer->{'title'}; $main_list2 = $main_list2 . "$title"; print outfile2 "$main_list2"; }