export variables in while loop

OK, I just can’t seem to figure this out. My variables don’t stay once the while loop is done, or they’re not getting down to the assign_vars array.

[php]$dj = request_var(‘dj’, ‘’);
$djname = ucwords(str_replace("_", " ", $dj));
$rate;
$genre;
$title;

page_header(‘Wicked Media Shoutcast Streams for Second Life’);

$query = “SELECT title, genre, maxbitrate
FROM accounts
WHERE username = '”.$username."’";

$details = mysql_query($query);
if ( mysql_affected_rows() == 1 ){
while ($row = mysql_fetch_assoc($details)) {
$rate = $row[‘maxbitrate’];
$genre = $row[‘genre’];
$title = $row[‘title’];
}
}

$template->assign_vars(array(
‘L_DJ’ => $dj,
‘L_DJ_NAME’ => $djname,
‘L_RATE’ => $rate,
‘L_GENRE’ => $genre,
‘L_TITLE’ => $title)
);

[/php]

The first two pairs in the $template->assign_vars(array( work just fine, but the other three don’t. I know it’s something simple. I’ve tried declaring them global in several different parts. Any help would be appreciated. :slight_smile:

I should add that they are getting the data because if I echo it instead of assigning it to a variable, it displays.

nevermind, boneheaded mistake, I forgot to pass a $_POST variable…

problem solved.

Sponsor our Newsletter | Privacy Policy | Terms of Service