PDA

View Full Version : Store echo within a variable?


Sean S
04-08-2006, 09:53 PM
Hi :)

could anyone tell me how I would store a echo statement within a variable? I tried the following but it didn't work :(


$sql = $DB_site->query("SELECT * FROM links, sponsor ORDER BY id DESC");
while($row = mysql_fetch_assoc($sql)) {
$sponsors = echo "
<table align=center border=0 cellspacing=0 cellpadding=5><tr><td class="alt1">
".($row['link'])." , ".($row['sponsor'])."<br />
</td>
</tr>
</table>
";
$i++;
}


do I have to use something else instead of echo and if I do, would the while loop still work? thanks in advance :)

Paul M
04-08-2006, 10:10 PM
Why are you trying to store the echo ?

Sean S
04-08-2006, 10:21 PM
Pretty much I want to store it in the variable, so that I can call it within a template or the custom page that I'm creating. Because if I just use the echo alone, the information appears at the very top of the page and above the header and everything else, hope I'm making any sense.

Reeve of shinra
04-08-2006, 11:23 PM
This is what you need...


https://vborg.vbsupport.ru/showthread.php?t=112497


eval('$navbar = "' . fetch_template('navbar') . '";');

Paul M
04-09-2006, 12:24 AM
Pretty much I want to store it in the variable, so that I can call it within a template or the custom page that I'm creating. Because if I just use the echo alone, the information appears at the very top of the page and above the header and everything else, hope I'm making any sense.You don't need the echo. Just store what you want to output in a variable, and add that variable to the template you want to use to display it.

Sean S
04-09-2006, 12:25 AM
thanks guys, I'll try that right now :)

Reeve of shinra
04-09-2006, 12:33 AM
er yeah, what paul said. For some reason I thought you were trying to call a template in a template. =p