Hi,
I’m trying to pass a value to WHERE ImageName = '$details’ in the code below but I can’t seem to find a way to do this.
If I run <?php echo $row_rstThumbs['ImageName']; ?> and it returns a value of say me.jpg and then hard code this into WHERE ImageName = 'me.jpg’ it works ok but when I try to pass this in a variable I either get an error saying “undefined variable details etc” I get the first or last value that the do loop returns.
Any ideas how to do this. I suppose what I’m trying to do is have the first value found in the loop passed to a variable for use outside the loop and this is where my problem is.
Thanks for any help
Brian
<? $colname_GetDetails = "1";
if (isset($_GET['ImageName'])) {
$colname_GetDetails = (get_magic_quotes_gpc()) ? $_GET['ImageName'] : addslashes($_GET['ImageName']);
}
mysql_select_db($database_kelly, $kelly);
$query_GetDetails = sprintf("SELECT * FROM tblimages WHERE ImageName = '$details'", $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
do { ?>
<?php $details= $row_rstThumbs['ImageName']; ?>
<a href="p7hg_img_4/fullsize/<?php echo $row_rstThumbs['ImageName']; ?> "><img src="p7hg_img_4/thumbs/<?php echo $row_rstThumbs['ThumbName']; ?>" ></a>
<?
} while ($row_rstThumbs = mysql_fetch_assoc($rstThumbs)); ?>
<?php echo $row_GetDetails['CaptionName']; ?>
<?php echo $row_GetDetails['TheCaption']; ?>