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
https://forums.phpfreaks.com/topic/204718-another-newbiegallery-with-categories/
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.

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

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.