Hello all,
I am a little stuck on this code. I was able to list all of my images and SUB-categories. But the result is not pleasing. It shows double....
Like this...
Maincategory
...img1.jpg
...Subcat1
...img1.jpg
...Subcat2
...img2.jpg
...Subcat1
...img2.jpg
...Subcat2
and etc...
Here is my code:
PHP Code:
if(isset($_POST['id']) || isset($_GET['id']))
{
$id = ( isset($_GET['id']) ) ? $_GET['id'] : $_POST['id'];
$id = htmlspecialchars($id);
//
$sql = "SELECT c.cat_id, c.cat_name, c.cat_parent, p.img_id, p.img_file, p.img_thumb, p.img_cat
FROM ". CATEGORIES_TABLE . " as c," . IMAGES_TABLE . " as p
WHERE p.img_cat = '$id' AND c.cat_parent = '$id'";
$result = dbQuery($sql) or die(dbError());