Im not even sure if these are called variables. But I am trying to call information from the database a different way than I usually do.

This is what is not working:

$id = mysql_real_escape_string($_GET['id'], $con);
/* once the file is imported, the variables set above will become available to it */

$select = ("SELECT * FROM shirts WHERE id = '$id' ");
$result = mysql_query($select) or die(mysql_error());
while($row = mysql_fetch_array($result))
  {
	$id = $id;
	$thumb = $row['thumb'];
	$title = $row['title'];
	$paypal = $row['paypal'];
	$tags = $row['tags'];
	$price = $row['price'];
  }
?>
<div class="storeWrap">
	<div class="thumbBox">
    	<a href="<?php $thumb ?>"rel="lightbox[<?php $id ?>]" title="<?php $title ?>"><img src="<?php $thumb ?>" width="340px"></a>
    </div>
	<div class="descMain">
    	<h2 align="left"><?php $title ?></h2><br />
        <div align="right"><?php $paypal ?> </div>
    </div>

</div>

I usually do this with limited issues:

echo "<div class='storeWrap'>";
$select = ("SELECT * FROM shirts ");
$result = mysql_query($select) or die(mysql_error());
while($row = mysql_fetch_array($result))
  {
  echo "<div class='shirtWrap'><div class='shirtThumb'>.......";
  }

echo "</div>";

Any suggestions on why my first block of code doesnt work? The page loads but I do not get any errors and I do not see the shirt I am trying to load.

Thanks,
Brian

Member Avatar for diafol

if you're getting a single value, you don't need the loop. However, can't see how this would affect things. In addition, leave out the $id = $id.

In addition, and this is the problem, you don't echo any of your variables:

<?php $thumb ?>

should be

<?php echo $thumb; ?>

Why is always something totally obvious and stupid that gets left out? In other words thanks! Everything seems to load just fine!

Member Avatar for diafol

Ok, mark it solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.