
 Ilja - 2009-04-22 11:03:50
 
function sub_select($sub_id){
  $menu_sel="";
  $db=$GLOBALS[db];
### SECOND QUERY
  $db->Query("SELECT * FROM $GLOBALS[menu_DB] where typ='2' and sub_id='$sub_id' order by id");
  for ($num = 0; $num < $db->RowCount(); $num++) {
   $sub_row = $db->Row($num);
   $menu_sel.="<option value=\"$sub_row->id\"> - $sub_row->name</option>";
  } 
 return $menu_sel;
}
$menu_sel="<select size=\"1"\ name=\"New_Menu\">";
### FIRST QUERY
 $db->Query("SELECT * FROM $menu_DB where typ='1' and lang='$lng' order by id");
 $num_max=$db->RowCount();
 for ($index = 0; $index < $num_max; $index++) {
  $row = $db->Row($index);
  $menu_sel.="<option value=\"$row->id\" $sel_lisa>$index $row->name $row->id</option>";
  $menu_sel.= sub_select($row->id);
 } 
 $menu_sel.="</select>";
echo $menu_sel;
If i call sub_select($row->id);, first Query is going to null!!!
Result mast be select menu:
Menu 1
 - SUB MENU
 - SUB MENU
 - SUB MENU
Menu 2
 - SUB MENU
Menu 3
Menu 4
Bat I loss all data in Second query;