Francois Dumais wrote:

> The need is to keep a list of subtopics names and ids in an array for use
> throughout the whole page.  I made it this way but I was wandering if
> midgard provided better ways of doing it.  I have a list of all
> mgd_bla_bla_functions under my eyes, but some of them I don't
> understand/appreciate fully the purpose (like walking trees).
>
> So, I have put in code-init the following code :
> <?
> $subtopics_list = mgd_list_topics($s);
> $elem_no=0;
>    while($subtopics_list ->fetch()){
>      $subtopics_name_array[$elem_no][0]=$subtopics_list->name;
>      $subtopics_name_array[$elem_no][1]=$subtopics_list->id;
>      $elem_no+=1;
>    }
> $row_no=(integer)(($elem_no+1)/2);
> ?>
>
> Is this approach OK?

Sure, but I'd simply use array_push instead of the elem_no counter:
   array_push($subtopics_name_array, array($subtopics_list->name, 
$subtopics_list->id));

Emile



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to