MyBB Community Forums

Full Version: retrieving data from mysql than making it repeat
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Ok I'm using this:

$main  = "SELECT * FROM poketech_links WHERE cat='Main'";
$result_main = mysql_query($main);
while($main_links = mysql_fetch_assoc($result_main))

and then I have a template:

	eval("\$site_middle = \"".$templates->get("site_middle")."\";");

and here's some of the code thats in that template:

<td class="trow1"> 
<a href="{$main_links['url']}">{$main_links['name']}</a>
<li class="pmfolders"><a href="private.php?fid=1">Inbox</a></li> 
<li class="pmfolders"><a href="private.php?fid=2">Sent Items</a></li>  
<li class="pmfolders"><a href="private.php?fid=3">Drafts</a></li>  
<li class="pmfolders"><a href="private.php?fid=4">Trash Can</a></li>  

I want it to like repeat where it says {$main_links['']} thats why I did the while() thing up in the part where you retrieve the data. But for some reason it only displays one thing of data instead of displaying the 3 rows of data that are in the database.

Can anyone help?
Try to use
eval("\$site_middle .= \"".$templates->get("site_middle")."\";");
Hey, thanks!!! Didn't think a little dot would make a big difference but oh well...
The dot represents a way to add to the variable.

$variable = "one";
$variable = "two";
$variable = "three";

In the above... $variable is defined as "three".

$variable = "one";
$variable .= "two";
$variable .= "three";

In this example the $variable is now "onetwothree".