Problem with while loop
Posted: Fri Jan 17, 2003 9:39 pm
i thnk there is something wrong with my loop here because it repeats the same thing for the number of items in the database and doesnt move the array counters to set it to the new data is just used the stuff from the first run through of the loop so its not moving up the array counters in $data for some reason
Code: Select all
$query = mysql_query("SELECT * FROM news ORDER BY date DESC");
while ($data = mysql_fetch_array($query)) {
// Convert From Unix Time
$data['date'] = date($datestyle, $data['date']);
$search = array('<DISPLAY: Subject>', '<DISPLAY: Date>', '<DISPLAY: Poster>', '<DISPLAY: Email>', '<DISPLAY: ComNum>', '<DISPLAY: Content>');
$replace = array($data['subject'], $data['date'], $data['poster'], $data['email'], $data['comnum'], $data['newstxt']);
$news_settings['newsstyle'] = str_replace($search, $replace, $news_settings['newsstyle']);
echo $news_settings['newsstyle'];
}
}