Template with maltipal outputs in template?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
darkpgn
Forum Newbie
Posts: 2
Joined: Wed Feb 05, 2003 7:30 pm

Template with maltipal outputs in template?

Post by darkpgn »

I am wondering do you guys know how to get my template to put out more than one item from one variable? i have it setup like this now....

Code: Select all

<?
require_once("class.FastTemplate.php3");
mysql_connect("localhost","user","pass") or die("Unable to connect to SQL server"); 
        mysql_select_db("database") or die("Unable to select database");
		$menu = "SELECT * FROM menu_left ORDER BY menu_order";
		$menu_left = mysql_query($menu);
		$menurow == mysql_fetch_array($menu_left);
$tpl = new FastTemplate("./templates");
  $tpl->define(array(
        'main'                   => "index.tpl",
      )
  );
  
$tpl->asign(array(
 "menu_left", $menurow&#1111;'menu_name']) );  
$tpl->parse(MAIN, "main");
$tpl->FastPrint();
?>
i only get one output and it ends up being the last item. can anyone help me fix this? thanks!
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

$menurow == mysql_fetch_array($menu_left);
compares $menurow to what's returned by mysql_fetch_array(), just an = too much.
And it's only getting one row (function's name maybe is confusing, but mysql_fetch_one_row_as_array is way too long ;) )
Take a look at http://www.php.net/manual/en/function.m ... -array.php as there are also examples how to retrieve the whole result-set.
darkpgn
Forum Newbie
Posts: 2
Joined: Wed Feb 05, 2003 7:30 pm

Post by darkpgn »

ok, illl look into that one. thanks for the help
Post Reply