Jump to content

Another newbie...Gallery with categories?


rajeevthomas

Recommended Posts

Hi ... I am a total newbie. I have been trying to build a simple gallery with Dreamweaver and a database. I am able to show larger image, from thumbs. I used a database, recordset, repeat regions.

 

But I do not know how to show categories. Can anyone give me any directions? Any tutorials? I am ready to provide you with any info you need...What I need to do is to be able click on gallery thumbs to go to image thumbs in that gallery category and then go to the larger version....  please help...:shifty:

Link to comment
Share on other sites

Well, this would be very helpful: http://tinyurl.com/yka2e56

 

But basically, in the database you have a table with categories and a table with images, like:

 

categories: category_id, category_name

images: image_id, category_id

 

On the category page you  would get all of the categories from the database and then print them out with urls to a page that would print out images with GET vars referencing a category.

 

So..

 

while($cat = mysql_fetch_assoc($categoryQuery)) {
     echo '<a href="images.php?category='.$cat['category_id'].'" />';
}

 

And then on images.php you would get images from the correct gallery from the database, so..

 

$sql = 'SELECT images FROM images WHERE category_id = "'.$_GET['category'].'"';

 

Add some error checking and the rest is obvious.

Link to comment
Share on other sites

l4nc3r.... I tied many tutorials... but I am not really intelligent enough to grasp what was in some of the tutorials. One example is Mayank's Dynamic PHP gallery in minutes on sitepoint site. God.... I tried it for many days. But got stuck and finding help for that thing was hard.  :confused:

 

But you gave me a great start... when I look at php I have one question all the time! .. 

 

 

 

while($cat = mysql_fetch_assoc($categoryQuery)) {
     echo '<a href="images.php?category='.$cat['category_id'].'" />';
}

 

In the code that you shown ... what are the areas I need to enter an absolute path to my folders? Should I change  ['category_id']  part to anything? To an absolute path...may be? Indicating my folders? is there any parts of the two code bits that you gave that I should change ? Or I use that code just like that if file names are the same as image.php and category.php?

 

 

Add some error checking and the rest is obvious.

 

Error checking... how do I do that? And the rest? what are the rest?  ::):confused:

 

I know I probably sound ridiculously stupid... I am not asking for the entire code but any hints  will help me...  :P

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.