Hi,
Thanks for the reply and as you can see I’m new to this. Basically in my database I have a field with details on each paining and I just wanted to display this on another part of my page to the right. You can see the actual page here
http://www.tyre-tyre.com/works_dynamic.php .
My problem was that I couldn’t get the information to display properly once outside the loop. For example if you look at the information on the right side you will see it doesn’t match the information at the bottom of the main image which I intended moving once I got this to display on the right hand side.
Below is the entire code of this page just in case it’s of any help. Maybe there is a better way but I thought if I could pass the value to $details= $row_rstThumbs['ImageName']; where $details would be like ‘0601_playing_on_sand.jpg’ then the correct information would be returned in relation to each main image on display. As I say if I hard code 0601_playing_on_sand.jpg (as seen in the live example) and replace $details with it, it works so I figured that’s all I needed in order to get this to work.
Thanks again for any further help
b
Code: Select all
<?php
mysql_select_db($database_kelly, $kelly);
$query_rstThumbs = "SELECT * FROM tblimages";
$rstThumbs = mysql_query($query_rstThumbs, $kelly) or die(mysql_error());
$row_rstThumbs = mysql_fetch_assoc($rstThumbs);
$totalRows_rstThumbs = mysql_num_rows($rstThumbs);
if (isset($row_rstThumbs['ImageName']) && file_exists('p7hg_img_4/fullsize/'.$row_rstThumbs['ImageName'])) {
$image_info_1 = getimagesize('p7hg_img_4/fullsize/'.$row_rstThumbs['ImageName']);
}
$dims_1 = isset($image_info_1) ? $image_info_1[3] : '';
?>
<body onLoad="P7_HGSinit(1,1,1,1,1,1,0,1)">
<div id="layout">
<div id="masthead2">
<div id="p7GSvpW3">
<div id="p7GSvp">
<div id="p7GSsc">
<ul>
<? $colname_GetDetails = "1";
if (isset($_GET['ImageName'])) {
$colname_GetDetails = (get_magic_quotes_gpc()) ? $_GET['ImageName'] : addslashes($_GET['ImageName']);
}
mysql_select_db($database_kelly, $kelly); // cant get $details to work here
$query_GetDetails = sprintf("SELECT * FROM tblimages WHERE ImageName = '0598_small_wooden_boat.jpg'", $colname_GetDetails);
$GetDetails = mysql_query($query_GetDetails, $kelly) or die(mysql_error());
$row_GetDetails = mysql_fetch_assoc($GetDetails);
$totalRows_GetDetails = mysql_num_rows($GetDetails); ?>
<?php
$counter = 0;
do { ?>
<?php
// include in loop to get each thumb dimension
if (isset($row_rstThumbs['ThumbName']) && file_exists('p7hg_img_4/thumbs/'.$row_rstThumbs['ThumbName'])) {
$image_info_1 = getimagesize('p7hg_img_4/thumbs/'.$row_rstThumbs['ThumbName']);
}$dims_t = isset($image_info_1) ? $image_info_1[3] : '';
if ($dims_t) { ?>
<li><div><?php echo $row_rstThumbs['ImageName']; ?> <?php echo $row_rstThumbs['TheCaption']; ?></div>
<a href="p7hg_img_4/fullsize/<?php echo $row_rstThumbs['ImageName']; ?> "<?php if ($dims_1) { ?> <?php echo $dims_1; }?>><img src="p7hg_img_4/thumbs/<?php echo $row_rstThumbs['ThumbName']; ?>" <?php echo $dims_t; }?> ></a>
</li>
<?php
$counter++;
if($counter % 4 == 0 && $totalRows_rstThumbs !=$counter)
{
echo "</ul><ul>";
}
} while ($row_rstThumbs = mysql_fetch_assoc($rstThumbs)); ?>
</ul>
</div>
</div>
</div>
<div id="p7GSnv"></div>
</div>
<div id="menubar">
<div id="p7TBM">
<div id="p7TBMroot">
<div id="p7TBMrootbox">
<ul>
<li><a href="#">home</a></li>
<li><a href="#">works</a></li>
<li><a href="#">biography</a></li>
<li><a href="#">contact</a></li>
<li><a href="#">news</a></li>
<li><a href="#">reviews</a><br>
</li>
</ul>
</div>
</div>
<!--[if lte IE 6]>
<style>#p7TBM div, #p7TBM ul, #p7TBM a {height:1%;}</style>
<![endif]-->
</div>
</div>
<div id="columnwrapper">
<div id="mainbox">
<div id="maincontent">
<div id="p7GS">
<div><?php //echo $name; ?> <?php //echo $row_GetDetails['TheCaption']; ?></div>
<div id="p7GSfs"></div>
<div id="p7GSpb"><img src="p7gs/images/prog-bar.gif" alt="Now Loading" width="125" height="22"></div>
<div id="p7GSah"></div>
<!--[if IE 5]><style>#p7GSvp,#p7GSfsc,#p7GSfsd{text-align:left;}#p7GSnv a{height:1em;width:1em;}</style><![endif]-->
<!--[if lte IE 6]><style>#p7GS{height:1%;}</style><![endif]-->
</div>
</div>
</div>
<div id="sidebox">
<div id="sidecontent">
<h3 class="topheading">Details</h3>
<p class="topheading">
<?php echo $row_GetDetails['CaptionName']; ?>
<?php echo $row_GetDetails['TheCaption']; ?>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
<p> </p>
</div></div>
<br class="clearit">
</div>
<div id="bottom"></div>
</div>
<div id="footerbox">
<div id="footer">
<p><?php include('footer.php'); ?></p>
</div>
</div>
</body>