Hi,
What is the best way to query my Categories table and Images table to get files and subfolders from DB?

ex.
file1
file2
file3
folder1
folder2
and etc...


Any suggestion?

I am using this query currently.
PHP Code:
$sql "SELECT c.cat_id, c.cat_parent, c.cat_name, p.img_id, p.img_file, p.img_thumb, p.img_desc, p.img_category, p.img_edit, p.img_date
                FROM "
CATEGORIES_TABLE " as c," IMAGES_TABLE " as p
                WHERE p.img_category = '
$id' AND c.cat_parent = '$id'"
        
$result dbQuery($sql) or die(dbError()); 
thanks,
Sami