andrew has asked for the wisdom of the Perl Monks concerning the following question:
Say my $id was 11, then it would return.@lists = check_id($id); print "In: @lists"; sub check_id { $ids = shift; $sthm = $dbh->prepare("SELECT name,parent FROM category WHERE id = '$ +ids'"); $sthm->execute or die $dbh->errstr; ($name,$parent) = $sthm->fetchrow_array; push(@info, $name); if($parent ne "0") { $line = check_id($parent); push(@info, $line); } return(@info); }
I have no idea why those numbers are there, there not suppost to be, heres what my table looks like in php my admin.ff xx aa other 4 5 6
| id | name | parent | description | view_cats_prod | ||
|---|---|---|---|---|---|---|
| Edit | Delete | 3 | snowmobiles | 0 | ||
| Edit | Delete | 4 | other | 0 | ||
| Edit | Delete | 5 | parts | 3 | ||
| Edit | Delete | 8 | a | 0 | a | a |
| Edit | Delete | 9 | aa | 4 | aa | no |
| Edit | Delete | 10 | xx | 9 | d | no |
| Edit | Delete | 11 | ff | 10 | ss | no |
| Edit | Delete | 12 | dd | 0 | ff | no |
| Edit | Delete | 13 | dd | 0 | ff | no |
| Edit | Delete | 17 | a | 12 | x | yes |
| Edit | Delete | 15 | a | 0 | a | yes |
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Looping through MySQL
by PodMaster (Abbot) on Jul 19, 2002 at 22:00 UTC | |
by andrew (Acolyte) on Jul 19, 2002 at 22:03 UTC | |
by PodMaster (Abbot) on Jul 19, 2002 at 22:16 UTC | |
by Aristotle (Chancellor) on Jul 19, 2002 at 22:19 UTC | |
by PodMaster (Abbot) on Jul 19, 2002 at 22:25 UTC | |
| |
by gryphon (Abbot) on Jul 19, 2002 at 22:47 UTC | |
|
Re: Looping through MySQL
by Aristotle (Chancellor) on Jul 19, 2002 at 22:13 UTC | |
|
Re: Looping through MySQL
by dws (Chancellor) on Jul 19, 2002 at 22:24 UTC | |
|
Re: Looping through MySQL
by Theseus (Pilgrim) on Jul 20, 2002 at 00:31 UTC | |
|
Re: Looping through MySQL
by flocto (Pilgrim) on Jul 20, 2002 at 13:42 UTC | |
| A reply falls below the community's threshold of quality. You may see it by logging in. |