[phplib] templates and SETBLOCK -- problem solved... From: Hyun Jo (hyun <email protected>)
Date: 12/06/00

I solved the problem on my own. i fixed it by changing the code --

------------------------------
$tmpl->set_block("main", "item_row", "item_rows");

  ## Traverse the result set

  if ($numrows < 1

   $tmpl->set_var("item_rows", " "); //<---- this if statement is what i
added
  }

  while ($db->next_record()){

  //get product categories
    $products_id = $db->f("products_id");
    $db2->query("select * from products_to_categories where products_id =
'$products_id'");
    $numrows2 = $db2->num_rows();

    $products_categories = "";

  while ($db2->next_record()){
      $numrows2--;
      $category_id = $db2->f("category_id");
      $db3->query("select category_name from categories where category_id =
'$category_id'");
      $db3->next_record();
      $products_categories .= $db3->f("category_name");
      if ($numrows2 > 0){
      $products_categories .= ", ";}
      }

    $tmpl->set_var(array( "form_action" => $sess->self_url(),
                          "products_id" => $db->f("products_id"),
                          "products_name" => $db->f("products_name"),
                          "products_model" => $db->f("products_model"),
                          "products_price" => $db->f("products_price"),
                          "products_categories" => $products_categories ));

    $tmpl->parse("item_rows", "item_row", true);

  }
----------------------------------
I hope this helps anyone that might have the same problem

Hyun Jo

---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>