Current location: Hot Scripts Forums » Programming Languages » PHP » Help with this code, thanks


Help with this code, thanks

Reply
  #1 (permalink)  
Old 05-09-07, 04:13 PM
samot samot is offline
Newbie Coder
 
Join Date: Apr 2007
Posts: 78
Thanks: 0
Thanked 0 Times in 0 Posts
Help with this code, thanks

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());

    if(
dbNumRows($result) > )
    {
        while(
$row dbFetchArray($result))
        {
            
$u_view_thumb "index.php?cmd=adm&exe=admin&show=album&get=image&img=view&id=".$row['img_id'];
            
// setup images    
            
$image_listing DIR_PATH $row['img_thumb'];    
            
            
// sub categories listing
            
$subcat_listing $row['cat_name'];
            
            
$template->assign_block_vars('image_listing', array(
                        
'IMAGE_LISTING' => $image_listing,
                        
'SUB_CATEGORIES' => $subcat_listing,
                        
'U_VIEW_THUMB'=> $u_view_thumb  ));    
        }
    }
    else
    {
        
$display_msg "THERE'S NO IMAGE IN CATEGORY";
    }

All I want to do is list all of the images and sub categories.
Help is appreciated.
Thanks you,
Samot
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Explanation of Code... Please davidk19380 Perl 1 02-26-06 01:50 PM
Zip Code search range errors Merovingian PHP 2 02-09-06 03:33 PM
Have a look at my JSP code which is not giving me the desired output j.gohel Everything Java 1 04-07-05 03:55 AM
Can anyone help me ? (problem using php variables in html db insert code) chronic_ PHP 2 06-13-04 11:19 AM
How to sale php code to customer without giving him code pradeep_soft PHP 4 03-12-04 12:10 PM


All times are GMT -5. The time now is 06:02 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.