Get all subfolders in a MySQL table using PHP.
PHP Programming.
Date Created:Friday March 09th, 2007 10:13 PM
Date Modified:Saturday August 02nd, 2008 03:55 PM
function get_subfolders ( $db, $parent_id, $get_info = false )
{
$fields = ( $get_info ) ? '*' : 'folder_id, title';
$query = 'SELECT ' .$fields. ' FROM folders WHERE parent_id = '. $parent_id;
$sth = mysql_query($db, $query);
while ( $row = mysql_fetch_row($sth, MYSQL_ASSOC) )
{
$folders[array_shift($row)] = $row;
}
return $folders;
}
Downloads:
Download: subfolders.php 391 B
Please login or Click Here to register for downloads
Get Subfolders by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at www.3daet.com
Permissions beyond the scope of this license may be available at http://www.3daet.com
