G'day all:
I have a var within a for loop that I print out the page. I also want it to be passed to other pages and I'm trying this using sessions, although the var is printed, everytime one goes from the new page back to the page where the var and the loop are initiated and then return to the page where the var has been passed via a session, twice as many of the same variable have been printed again and then 2 more etc etc??!!
//First page:
while($row = mysql_fetch_array($result)) {
$affd = $row['affiliation'];
for($count = 0; $count < count ($affd); $count++) {
$aff_list = $aff_list . "$affd ";
}
//-end for
}
//end-while
//$aff_list is passed as a session and
//printed to a new page - where multiple
//versions of itself occur
//second page:
echo "$aff_list";
The reason I'm doing it this way is to restrict the number of calls I have to make to the DB. If I didn't do it by passing a session then I would have to query the DB on every page I wish this info to be displayed.
Any ideas on how I can prevent these 'multuple variable occurences'??
Cheers:
Russ