in reply to Re: Using SQL to create menu entries (was: Could u pls help me to solve....)
in thread Using SQL to create menu entries (was: Could u pls help me to solve....)

OK, I've slept on it, the SELECT definitely doesn't guarantee to give you the parents before the children
So, that doesn't matter if you do the autoviv correct:
my $sth = $dbh->prepare("SELECT category_id, category_name, main_categ +ory FROM test"); $sth->execute(); $sth->bind_columns(\my($category_id, $category_name, $main_category)); my @cats; while ($sth->fetch) { $cats[$category_id][0] = $category_name; push @{$cats[$main_category][1]}, $category_id; }
Autoviv is cool, when used properly.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

  • Comment on •Re: Re: Using SQL to create menu entries (was: Could u pls help me to solve....)
  • Download Code