PDA

View Full Version : Folders and categories


images
06-13-2010, 08:23 AM
I am a newbie and I really don't know what I am doing. I would like to create a gallery. My goal is to have thumbs showing a set of galleries and when I click on each thumb that will take me to the thumbs of images in that category.

Here I used a database which contains 'id', 'gallery thumbs' , 'image thumbs' and then 'larger image'. I created php file with recordset and repeat region.

I am able to show the gallery thumbs and then when I click on them, I am getting all the images not just the ones in the category.

How do get to show just the images in each categories? :confused: My code for the gallery thumbs is below...



<?php require_once('Connections/dsThumbs.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

mysql_select_db($database_dsThumbs, $dsThumbs);
$query_rsThumbs = "SELECT * FROM gallerythumbs ORDER BY gallerytitle ASC";
$rsThumbs = mysql_query($query_rsThumbs, $dsThumbs) or die(mysql_error());
$row_rsThumbs = mysql_fetch_assoc($rsThumbs);
$totalRows_rsThumbs = mysql_num_rows($rsThumbs);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php do { ?>
<p> <a href="imagethumbs.php"> <img src="<?php echo $row_rsThumbs['gallerythumbs']; ?>" /> </a></p>
<p><a href="imagethumbs.php"><?php echo $row_rsThumbs['gallerytitle']; ?></a></p>


<?php } while ($row_rsThumbs = mysql_fetch_assoc($rsThumbs)); ?></body>
</html>
<?php
mysql_free_result($rsThumbs);
?>

davidj
06-16-2010, 09:36 AM
you have a separate page called imagethumbs.php ?

images
06-16-2010, 10:10 AM
you have a separate page called imagethumbs.php ?

Davidj thank you for replying. I am a total newbie. Yes you are right. I have two pages. thumbs.php ( this will represent my different galleries) and imagethumbs.php ( this will show the thumbs of images in that particular gallery). I might be wrong to have this ? Right now ..what I am getting is "all of my images when click on my gallery thumbs. Not just that category.

And I just learned that I need to have a category id in my database to show categories !! I know I know I am slow! So I created that in the database.

But do not know how to pull that info using php! Any clues will help...

davidj
06-16-2010, 03:49 PM
Its very hard to help without providing you with the code to paste in which I never do

All I can suggest really is to learn how to code. It gives you wings! :idea:

If you want to learn check my signature out.

I hand the baton over to someone who wants to write the solution

images
06-16-2010, 07:07 PM
Its very hard to help without providing you with the code to paste in which I never do

All I can suggest really is to learn how to code. It gives you wings! :idea:

If you want to learn check my signature out.

I hand the baton over to someone who wants to write the solution

Davidj... is there anyway I can get that code you mentioned? I just saw the signature. Is there anyway you can teach me, how to solve my specific problem? Of course I will take the course but is there anyway to focus on my problem and only that... For right now... I don't know if I can learn coding from the very beginning just for this gallery because of time constraints. But when I am done with the gallery I would love to do that full course. Because PHP looks very interesting. Primarily though I am a photographer.... so I need a gallery first :-)

edbr
06-17-2010, 02:37 AM
I am asuming you are using the dw wizard here .
you say when you click on the category , how do you do that with a form?
i would pass as a link.
for instance <a href ="results.php?category=dog"> Dog</a>

on your results page make a recordset using the value $_GET ( or maybe it says URL , i cant remember) use that value.

it should make a select query ending in where category (if that is what you called the field) =$_GET['category'] .

however i hope you do look at the learning side davidj made some vids in the tutorial section which may help you get a grasp ad taste for taking it further. tor modify ithe Dw wizard does kinda work but gets tricky when you want to extend it .