$SQL = "SELECT * FROM $database_table order by date DESC, ID DESC limit 10"; $sth = $dbh->prepare($SQL); $sth->execute; open(TXTFILE, ">$rootpath$categoryDir$frontPage"); while ($pointer = $sth->fetchrow_hashref) { $fullpath = $pointer->{'fullfilepath'}; $name = $pointer->{'filename'}; $thumbnail = $pointer->{'thumbnail'}; $image = $pointer->{'image'}; $imagewidth = $pointer->{'imagewidth'}; $headlinelink = $pointer->{'headlinelink'}; print TXTFILE <$title
$category - $month $day, $year $catsiteshow
TEXT }