Hi,
this perl code does not fetch the subcategories as you may think when reading the first line
# Fetch the subcategory list.
$get_links = $LINKDB->prepare("SELECT * FROM Links WHERE CategoryID = ? ORDER BY ...);
This line prepares a recordset with a unknown CategoryID (CategoryID =?).
$get_links->execute ($category_r->{'ID'});
Here you tell the recordset ($get_links) to use the CategoryID with the value of $category_r->{'ID'}
$links_r = $get_links->fetchall_arrayref || [];
now you store the records in an array ($links_r ) if you have records. If you don't it will be empty ( || []).
In $links_r you now have all the links with the CategoryID = $category_r->{'ID'}
As for the prepare statement have a look at
http://www.mysql.com/documentation/mysql/commented/manual.php?section=Reference
hope it helps,
regards, alexander
this perl code does not fetch the subcategories as you may think when reading the first line
# Fetch the subcategory list.
$get_links = $LINKDB->prepare("SELECT * FROM Links WHERE CategoryID = ? ORDER BY ...);
This line prepares a recordset with a unknown CategoryID (CategoryID =?).
$get_links->execute ($category_r->{'ID'});
Here you tell the recordset ($get_links) to use the CategoryID with the value of $category_r->{'ID'}
$links_r = $get_links->fetchall_arrayref || [];
now you store the records in an array ($links_r ) if you have records. If you don't it will be empty ( || []).
In $links_r you now have all the links with the CategoryID = $category_r->{'ID'}
As for the prepare statement have a look at
http://www.mysql.com/documentation/mysql/commented/manual.php?section=Reference
hope it helps,
regards, alexander