PDA

View Full Version : PHP Image Gallery Guidance


tux
03-27-2008, 01:45 PM
Hi All,

If have spent the last few weeks learning CSS and converting a website to CSS from tables (tables ahhgg Spit).

I am now going to continue learning PHP and populate the gallery on the site using PHP and MySQL. I have revisited Djs vids and am now looking for some guidance. I have so far populated the thumbnail page but need some advice on selecting the correct images from the DB. The gallery entry page has 6 images each pointing to a different Category. ie. Landscapes, Still Life, etc.. So each image must be from the correct Category. ie. the first image from each category in the DB. The categorys are as follows....

Abstract : ImgCatID=1
Landscape : ImgCatID=2
Industry : ImgCatID=3
People : ImgCatID=4
Food : ImgCatID=5
Still Life : ImgCatID=6

The DB has... ImageID, ImgTitle, ImgURLthumb, ImgURLmain, ImgCat, ImgCatImg, ImgCatID.

Here is my code so far.....

<?php
require_once("Connections/PbyDTconnection.php"); // database connection

///////////////////////////////////////////
$query = sprintf("SELECT * FROM images");
$result = @mysql_query($query);
$images = @mysql_fetch_array($result);
///////////////////////////////////////////

?>

and....

<div id="gal_holder">
<div class="img_left">
<div class="img1"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat1"><a target="_blank" href="#">h3><img src="Images/Titles/landarch.gif" alt="Landscape & Architecture" width="120" height="35"></h3></a></div>
</div>
<div class="img_right">
<div class="img2"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat2"><a target="_blank" href="#"><h3><img src="Images/Titles/peopanim.gif" alt="People & Animals" width="120" height="35"></h3></a></div>
</div>
<div class="img_left">
<div class="img1"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat1"><a target="_blank" href="#"><h3><img src="Images/Titles/abbgds.gif" alt="Abstract & Backgrounds" width="120" height="35"></h3></a></div>
</div>
<div class="img_right">
<div class="img2"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat2"><a target="_blank" href="#"><h3><img src="Images/Titles/fooddrnk.gif" alt="Food & Drink" width="120" height="35"></h3></a></div>
</div>
<div class="img_left">
<div class="img1"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat1"><a target="_blank" href="#"><h3><img src="Images/Titles/indbusi.gif" alt="Industry & Business" width="120" height="35"></h3></a></div>
</div>
<div class="img_right">
<div class="img2"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat2"><a target="_blank" href="#"><h3><img src="Images/Titles/still.gif" alt="Still Life" width="120" height="35"></h3></a></div>
</div>
</div>
</div>
<div id="footer"><p>&copy; Copyright 2007 - <?php echo date("Y") ?> Photography by Dan Tucker</p></div>
<img id="logo_left" src="Images/logo_left.gif" alt="Photography By Dan Tucker" width="147" height="297">
</div>

Many thanks.

Regards, Paul

smitho
03-28-2008, 12:36 AM
Hi Paul,

looking at your code I would be guessing the result your getting is the same image on each line?

This is because the you are not flagging a specific row/images.

To test this change:


$query = sprintf("SELECT * FROM images");

//to

$query = sprintf("SELECT * FROM images WHERE id=2");

Then try changing 2 to 3 then to 4. You should see the images change.

A little while ago I tried the mysql_field_seek() as suggested by davidj but could not get it work. You may have better luck.



$query="SELECT * FROM images";
$result=mysql_query($query);
$images = mysql_fetch_array($result);
echo $images["ImgURLthumb"] . ' ' . $images["ImgTitle"].'<br>'; // Output is
mysql_field_seek($result,2);
echo $images["ImgURLthumb"] . ' ' . $images["ImgTitle"].'<br>'; // Output is

smitho
03-28-2008, 12:49 AM
After sending my reply I thought I'd give this another try. This seems to work.

For anyone who has done davidj's tut you can use this:


$specificsql="SELECT * FROM table1";
$specificresult=mysql_query($specificsql);
$specificrow = mysql_fetch_array($specificresult);
echo $specificrow['field2'] . ' ' . $specificrow['field1_id'].'<br>'; // Output is
$specificrow = mysql_fetch_array($specificresult,'3');
echo $specificrow['field2'] . ' ' . $specificrow['field1_id'].'<br>'; // Output is
$specificrow = mysql_fetch_array($specificresult,'3');
echo $specificrow['field2'] . ' ' . $specificrow['field1_id'].'<br>'; // Output is
$specificrow = mysql_fetch_array($specificresult,'3');
echo $specificrow['field2'] . ' ' . $specificrow['field1_id'].'<br>'; // Output is
so Paul try this:


$query="SELECT * FROM images";
$result=mysql_query($query);
$images = mysql_fetch_array($result);
echo $images["ImgURLthumb"] . ' ' . $images["ImgTitle"].'<br>'; // Output is
$images = mysql_fetch_array($result,'3');
echo $images["ImgURLthumb"] . ' ' . $images["ImgTitle"].'<br>'; // Output is
$images = mysql_fetch_array($result,'3');
echo $images["ImgURLthumb"] . ' ' . $images["ImgTitle"].'<br>'; // Output is
$images = mysql_fetch_array($result,'3');
echo $images["ImgURLthumb"] . ' ' . $images["ImgTitle"].'<br>'; // Output is
$images = mysql_fetch_array($result,'3');
echo $images["ImgURLthumb"] . ' ' . $images["ImgTitle"].'<br>'; // Output is
$images = mysql_fetch_array($result,'3');
echo $images["ImgURLthumb"] . ' ' . $images["ImgTitle"].'<br>'; // Output is

smitho
03-28-2008, 01:40 AM
Ok finally worked out the data seek. Do not know why the previous post worked but I would use this:


$specificsql="SELECT * FROM table1";
$specificresult=mysql_query($specificsql);
$specificrow = mysql_fetch_row($specificresult);
echo $specificrow[0] . ' ' . $specificrow[1].'<br>'; // Output is first row

mysql_data_seek( $specificresult,1 );
$specificrow = mysql_fetch_row($specificresult);
echo $specificrow[0] . ' ' . $specificrow[1].'<br>'; // Output is second row

mysql_data_seek( $specificresult,2 );
$specificrow = mysql_fetch_row($specificresult);
echo $specificrow[0] . ' ' . $specificrow[1].'<br>'; // Output is third row

mysql_data_seek( $specificresult,3 );
$specificrow = mysql_fetch_assoc($specificresult);
echo $specificrow['field1_id'] . ' ' . $specificrow['field2'].'<br>'; // Output is fourth row using assoc rather than num.



Paul try:


$query="SELECT * FROM images";
$result=mysql_query($query);
$images = mysql_fetch_assoc($result);
echo $images["ImgURLthumb"] . ' ' . $images["ImgTitle"].'<br>'; //

mysql_data_seek( $specificresult,1 );
$images = mysql_fetch_assoc($result);
echo $images["ImgURLthumb"] . ' ' . $images["ImgTitle"].'<br>'; //

tux
03-28-2008, 11:20 AM
Thanks for your help Smitho but that is not quite what I'm after.

I maybe did not explain things quite right. The DB is so far populated with about 70 odd images, all with different categorys ( imgCatID ). I need to search through the DB and pick the first image from each of the 6 categorys. So first image would be where the imgCatID = 1, then imgCatID = 2, etc. I can search by one category ok using for example ....

$query = sprintf("SELECT * FROM images where imgCatID = 1");
$result = @mysql_query($query);
$images = @mysql_fetch_array($result);

.... but I need one image from each category. Not just the first 6 rows of the DB. The categorys are random in the DB.

I was thinking maybe I'd have to use a separate sql statement for each, something like......


///////////////////////////////////////////
$query = sprintf("SELECT * FROM images where imgCatID = 1");
$result1 = @mysql_query($query);
$images1 = @mysql_fetch_array($result1);
///////////////////////////////////////////

///////////////////////////////////////////
$query = sprintf("SELECT * FROM images where imgCatID = 2");
$result2 = @mysql_query($query);
$images12 = @mysql_fetch_array($result2);
///////////////////////////////////////////

///////////////////////////////////////////
$query = sprintf("SELECT * FROM images where imgCatID = 3");
$result3 = @mysql_query($query);
$images3 = @mysql_fetch_array($result3);
///////////////////////////////////////////

///////////////////////////////////////////
$query = sprintf("SELECT * FROM images where imgCatID = 4");
$result4 = @mysql_query($query);
$images4 = @mysql_fetch_array($result4);
///////////////////////////////////////////

///////////////////////////////////////////
$query = sprintf("SELECT * FROM images where imgCatID = 5");
$result5 = @mysql_query($query);
$images5 = @mysql_fetch_array($result5);
///////////////////////////////////////////

///////////////////////////////////////////
$query = sprintf("SELECT * FROM images where imgCatID = 6");
$result6 = @mysql_query($query);
$images6 = @mysql_fetch_array($result6);
///////////////////////////////////////////

It just seems a bit long winded. I'll give it a go and let you know.

Regards, Paul

tux
03-28-2008, 11:55 AM
Okay using a seperate statement for each worked fine, still think its a bit long winded but maybe Dj could advise if he see this.

More advice needed soon on the gallery results page but I'll start a new thread when I get stuck.

Thanks Smitho.

Regards, Paul

davidj
03-28-2008, 01:17 PM
///////////////////////////////////////////
for($i=0; $i < 6; $i++){

$query = sprintf("SELECT * FROM images where imgCatID = '$i'");
$result.$i = @mysql_query($query);
$images.$i = @mysql_fetch_array($result.$i);
///////////////////////////////////////////

}

tux
03-28-2008, 02:45 PM
David,

I've mulled your code over but cant figure out its logic.

Could you explain what the $i variable is doing and how it will call the different images.

Also, what would I now use in my HTML to call the info where I currently have for eg.....

<?php echo $images1["ImgURLthumb"] ?>

Thanks Dj

Regards, Paul

smitho
03-29-2008, 02:42 AM
tux you don't need a seperate statement for each.

Try this:


<?php
require_once("Connections/PbyDTconnection.php"); // database connection

$query="SELECT * FROM images";
$result=mysql_query($query);
$images = mysql_fetch_assoc($result);
?>



<!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>
<div id="gal_holder">
<div class="img_left">
<div class="img1"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat1"><a target="_blank" href="#">h3><img src="Images/Titles/landarch.gif" alt="Landscape & Architecture" width="120" height="35"></h3></a></div>
</div>
<?php mysql_data_seek( $result,1 );
$images = mysql_fetch_assoc($result);?>
<div class="img_right">
<div class="img2"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat2"><a target="_blank" href="#"><h3><img src="Images/Titles/peopanim.gif" alt="People & Animals" width="120" height="35"></h3></a></div>
</div>
<?php mysql_data_seek( $result,2 );
$images = mysql_fetch_assoc($result);?>
<div class="img_left">
<div class="img1"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat1"><a target="_blank" href="#"><h3><img src="Images/Titles/abbgds.gif" alt="Abstract & Backgrounds" width="120" height="35"></h3></a></div>
</div>
<?php mysql_data_seek( $result,3 );
$images = mysql_fetch_assoc($result);?>
<div class="img_right">
<div class="img2"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat2"><a target="_blank" href="#"><h3><img src="Images/Titles/fooddrnk.gif" alt="Food & Drink" width="120" height="35"></h3></a></div>
</div>
<?php mysql_data_seek( $result,4 );
$images = mysql_fetch_assoc($result);?>
<div class="img_left">
<div class="img1"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat1"><a target="_blank" href="#"><h3><img src="Images/Titles/indbusi.gif" alt="Industry & Business" width="120" height="35"></h3></a></div>
</div>
<?php mysql_data_seek( $result,5 );
$images = mysql_fetch_assoc($result);?>
<div class="img_right">
<div class="img2"><a target="_blank" href="#"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" width="140" height="95"></a></div>
<div class="cat2"><a target="_blank" href="#"><h3><img src="Images/Titles/still.gif" alt="Still Life" width="120" height="35"></h3></a></div>
</div>
</div>
</div>
<div id="footer"><p>&copy; Copyright 2007 - <?php echo date("Y") ?> Photography by Dan Tucker</p></div>
<img id="logo_left" src="Images/logo_left.gif" alt="Photography By Dan Tucker" width="147" height="297">
</div>
</body>
</html>

tux
03-29-2008, 09:04 AM
Smitho,

I tried your code and it just returns the first 6 rows of the DB instead of returning the first record from each category.

It also throws my CSS layout off.

Do you understand Djs suggestion.....

///////////////////////////////////////////
for($i=0; $i < 6; $i++){

$query = sprintf("SELECT * FROM images where imgCatID = '$i'");
$result.$i = @mysql_query($query);
$images.$i = @mysql_fetch_array($result.$i);
///////////////////////////////////////////

}

..... I cant figure out how it selects each category and how to implement it in my HTML.

Thanks for your imput tho'.

Regards, Paul

smitho
03-29-2008, 10:20 AM
Sorry Paul,

My fault mis read your first post and did not realise you had an ImageID and an ImageCatID.

What davidj provided should give you the result you are after.

Your example:


///////////////////////////////////////////
$query = sprintf("SELECT * FROM images where imgCatID = 1");
$result1 = @mysql_query($query);
$images1 = @mysql_fetch_array($result1);
/////////////////////////////////////////// davidj example which loops 6 times to return the same as your example:


///////////////////////////////////////////
for($i=0; $i < 6; $i++){

$query = sprintf("SELECT * FROM images where imgCatID = '$i'");
$result.$i = @mysql_query($query);
$images.$i = @mysql_fetch_array($result.$i);
///////////////////////////////////////////

}
Unfortunalty I don't have a database setup similar to yours so it's hard to test this but the code look correct to me. You may want to try "SELECT * FROM images where imgCatID = $i" take out ' '. Now becuase you start ImageCatID at 1 you may also want to try for($i=1; $i < 6; $i++){ this will make the first time the loop run set $result.$i to return $result1 similar to your example. The second time it runs through the loop you should get $result.$i to return $result2.

If you want to see what is being returned try:


//davidj code here
///////////////////////////////////////////

echo "This is i ".$i."<br>";
echo "This is query ".$query ."<br>";
echo "This is result ".$result.$i."<br>";
echo "This is image ".$images.$i['ImageCatID']."<br>";
}
Hope this helps.

tux
03-29-2008, 10:37 AM
I gave this a go to see what was returned. I ran the page and get this.....

This is i
This is query SELECT * FROM images where imgCatID = '1'
This is result
This is image

.... then this all the way down the page

This is i
This is query SELECT * FROM images where imgCatID = ''
This is result
This is image

and finally this error at the bottom??

Fatal error: Maximum execution time of 30 seconds exceeded in C:\wamp\www\PhotographyByDanTucker\gallery.php on line 13

The code is looping through the whole DB of some 70 odd entries and only returning the ImgCatID on the first loop??

Any ideas.

smitho
03-29-2008, 11:21 AM
Hey Paul,

Can you give this a go:


///////////////////////////////////////////
for($i=1; $i<6; $i++){

$query = sprintf("SELECT * FROM images WHERE imgCatID=$i");
$result = @mysql_query($query);
$images = @mysql_fetch_array($result);
///////////////////////////////////////////

echo "This is i ".$i."<br>";
echo "This is query ".$query ."<br>";
echo "This is result ".$result."<br>";
echo "This is image ".$images['imgCatID']."<br>";
}
I think the problem was $result.$i and $image.$i.

tux
03-29-2008, 12:52 PM
I tried this....

<?php
require_once("Connections/PbyDTconnection.php"); // database connection

///////////////////////////////////////////
for($i=1; $i < 7; $i++){

$query = sprintf("SELECT * FROM images where imgCatID = '$i'");
$result = @mysql_query($query);
$images = @mysql_fetch_array($result);
///////////////////////////////////////////
echo "This is i ".$i."<br>";
echo "This is query ".$query ."<br>";
echo "This is result ".$result.$i."<br>";
echo "This is image ".$images.$i['ImageCatID']."<br>";
}

?>

.....and got this....

This is i 1
This is query SELECT * FROM images where imgCatID = '1'
This is result Resource id #41
This is image Array
This is i 2
This is query SELECT * FROM images where imgCatID = '2'
This is result Resource id #52
This is image Array
This is i 3
This is query SELECT * FROM images where imgCatID = '3'
This is result Resource id #63
This is image Array
This is i 4
This is query SELECT * FROM images where imgCatID = '4'
This is result Resource id #74
This is image Array
This is i 5
This is query SELECT * FROM images where imgCatID = '5'
This is result Resource id #85
This is image Array
This is i 6
This is query SELECT * FROM images where imgCatID = '6'
This is result Resource id #96
This is image Array

This seems okay as I'm getting the different ImgCatID's, but how do I use the data in my HTML to call the images. The $images variable is now an Array so I suppose I will need the key for the file name???

Cheers.

smitho
03-29-2008, 10:59 PM
Did you try $images['imgCatID']?


echo "This is image ".$images['ImageCatID']."<br>";

tux
03-30-2008, 08:35 PM
Hi Smitho,

The data echos out okay. I tried this.....

<?php
for($i=1; $i < 7; $i++){

$query = sprintf("SELECT * FROM images where ImgCatID = '$i'");
$result = @mysql_query($query);
$images = @mysql_fetch_array($result);
///////////////////////////////////////////
echo "This is image ".$images['ImgCatID']."<br>";
echo "This is image file ".$images['ImgURLthumb']."<br>";
}
?>

.... and get this....

This is image 1
This is image file DTLAND0001.jpg
This is image 2
This is image file DTPEOP0001.jpg
This is image 3
This is image file DTABST0001.jpg
This is image 4
This is image file DTFOOD0001.jpg
This is image 5
This is image file DTIND0001.jpg
This is image 6
This is image file DTSTILL0001.jpg

The problem is how do I call the data in my HTML to get the different images.

This is my HTML.....

<div class="img1"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" ></a></div>
<div class="cat1"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><h3><img src="Images/Titles/landarch.gif" alt="<?php echo $images["ImgCat"] ?>" title="<?php echo $images1["ImgCat"] ?>" ></h3></a></div>
</div>
<div class="img_right">
<div class="img2"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" ></a></div>
<div class="cat2"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><h3><img src="Images/Titles/peopanim.gif" alt="<?php echo $images["ImgCat"] ?>" title="<?php echo $images["ImgCat"] ?>"></h3></a></div>
</div>
<div class="img_left">
<div class="img1"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" ></a></div>
<div class="cat1"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><h3><img src="Images/Titles/abbgds.gif" alt="<?php echo $images["ImgCat"] ?>" title="<?php echo $images["ImgCat"] ?>"></h3></a></div>
</div>
<div class="img_right">
<div class="img2"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" ></a></div>
<div class="cat2"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><h3><img src="Images/Titles/fooddrnk.gif" alt="<?php echo $images["ImgCat"] ?>" title="<?php echo $images["ImgCat"] ?>"></h3></a></div>
</div>
<div class="img_left">
<div class="img1"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" ></a></div>
<div class="cat1"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><h3><img src="Images/Titles/indbusi.gif" alt="<?php echo $images["ImgCat"] ?>" title="<?php echo $images["ImgCat"] ?>"></h3></a></div>
</div>
<div class="img_right">
<div class="img2"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><img src="images/Gallery/Thumbs/<?php echo $images["ImgURLthumb"] ?>" alt="<?php echo $images["ImgTitle"] ?>" title="<?php echo $images["ImgTitle"] ?>" ></a></div>
<div class="cat2"><a href="gallery2.php?ImgCatID=<?php echo $images["ImgCatID"] ?>"><h3><img src="Images/Titles/still.gif" alt="<?php echo $images["ImgCat"] ?>" title="<?php echo $images["ImgCat"] ?>"></h3></a></div>

This gives me the same image intsead of 6 different ones??

Any ideas.

Regards, Paul

smitho
03-30-2008, 10:52 PM
Now I could be wrong but the way I understand it you'll need to create your div tags etc in your php code.

So where you have

echo "This is image ".$images['ImgCatID']."<br>";
echo "This is image file ".$images['ImgURLthumb']."<br>";

You will need to do something like this:


echo "<div class='img1'><a href='gallery2.php?ImgCatID=$images[ImgCatID]'><img src='images/Gallery/Thumbs/$images[ImgURLthumb]' alt='$images[ImgTitle]' title='$images[ImgTitle]' ></a></div>"
echo "<div class='cat1'><a href='gallery2.php?ImgCatID=$images[ImgCatID]'><h3><img src='Images/Titles/landarch.gif' alt='$images[ImgCat]' title='$images1[ImgCat]' ></h3></a></div>"
echo "</div>"

///and so on.

tux
04-01-2008, 09:10 AM
If thats the case I just as well revert back to 6 seperate queries.

If someone does know how this can be done it would be great to find out.

Thanks for your help Smitho.

Regards, Paul