save html created by loop in variable

From: Date: Wed, 17 Apr 2002 22:47:07 +0000
Subject: save html created by loop in variable
Groups: php.general 
Request: Send a blank email to php-general+get-93427@lists.php.net to get a copy of this message
I have a WHILE loop that I am interested in storing the html that is generated based on its results to a variable. This variable would then be echoed later on. Basically the html that is generated from the while loop is a bunch of table cell definitions and some data from the database - this data is manipulated with some IF statements in the loop. So I'd want to store something like this: while ($row=mysql_fetch_array($result)) { ?> <tr> if ($variable==1) { //store on <td><?=$variable;?></td> //store off } if ($variable==2) { //store on <td><?=$variable;?></td> //store off and so on. } </tr> <?php } I tried to use something like $store.="<td>$variable</td>"; for each time something needs to be displayed but it didn't display anything. Any ideas how I could create such a thing? thanks in advance! :) __________________ Jason Dulberg

« previous php.general (#93427) next »