0

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

2
Contributors
3
Replies
4
Views
6 Years
Discussion Span
Last Post by diafol
0

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; ?>
0

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

Edited by bjeffries: n/a

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.