Hi,

I am finding this quiet difficult trying to sort this out, I am not so familiar with backend mysql,php programming but i am getting by thanks to help.

At the moment no data is being echoed? although data is present.

If some one can help me with the source, see where i'm going wrong would be very much apreciated.

OK this is what I’ve done so far:

The DB:

category:
id (pk, auto increment)
category_id (index)

products:
id (fk to category_id)
name (index)
description
measurements

product_image:
product_id (fk to name)
filename
thumbnail

Now, I have menu (list item) were you can select the type of category linking to product_range.php:


Code:
<?php
$link = mysql_connect('localhost', 'root', 'taycon');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo '';
mysql_select_db("wp");
?>


<?php

	// query db
	$sql = mysql_query ("SELECT * FROM `category` ORDER BY ID ASC");
	// echo linked result from db
   if($resource and !is_bool($resource)) {
    $row = mysql_fetch_assoc($resource);
 }
	while ($row = mysql_fetch_assoc($sql)){
	
    echo "<a href='product_range.php?id={$row['category_id']}' "; echo ($fullpath == "product_range.php?category_id={$row['category_id']}") ? 'id="select"' : ''; echo ">" . ($row['category_id']) . "</a>";
} 
?>

OK, This is the code for the product_range.php, so for example a user selects "Arks" from the menu, the product_range.php displays all the data relevant to Arks with each product and images eg -

Arks (title) - Deluxe Ark (product) - Description - Measurments - image 1 (product_image) image2 image 3 so on.

Code:
<?php include ("include/head.php"); ?>

<body>

<?php include ("include/header.php"); ?>

<div class="wrapper">

<?php include ("include/topnav.php"); ?>

<!-- data div -->
<div class="datadiv">

<div class="datadivleft">

<?php
$link = mysql_connect('localhost', 'root', 'taycon');
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
echo '';
mysql_select_db("wp");
?>



<?php

// query db
if (isset($_GET['id'])) {
    $sql = "SELECT category.id as category_pk, category_id, products.* from category, products WHERE products.id = category.category_id AND category.id = ?" . mysql_real_escape_string($_GET['id']) . "'"; // from category get id
    if ($result = mysql_query($sql)) {
      if (mysql_num_rows($result)) {
        $row = mysql_fetch_assoc($result);
        echo "<h2>" . $row['category_id'] . "</h2>";
		} else {
		echo "Something is wrong!";
      }
    }
  }
?>
	<div class="datadivleftcontent">

<?php
// query db
if (isset($_GET['id'])) {
    $sql = "SELECT products_image.* FROM products_image, products WHERE products_image.id = products.name AND products_image.id = ?" . mysql_real_escape_string($_GET['id']) . "'"; // from products get id
    if ($result = mysql_query($sql)) {
      if (mysql_num_rows($result)) {

     while ($row = mysql_fetch_assoc($result)) { //initial the loop

        echo "<h4>" . $row['name'] . "</h4>"; // echo date results as format "h4"
		echo "<p>" . $row['description'] . "</p>"; // echo content as p format "body text"
		echo "<h5>Measurements: " . $row['measurements'] . "</h5>"; // echo content as p format "body text"

echo "<a href='img/products/{$row['filename']}' rel='lightbox' title='{$row['name']}'>"; 

echo "<img src='img/products/thumbnails/{$row['filename']} 'alt='{$row['name']}' title='{$row['name']}' width='173' height='136'></a>";


}
		} else {
		echo "Something is wrong!";
      }
    }
  }
?>


</div>


</div>

</div>
<!-- end -->

<?php include ("include/showcase.php"); ?>

<?php include ("include/btmcontent.php"); ?>

</div>

<?php include ("include/footer.php"); ?>

</body>
</html>

Now at present i cannot get any data echoed from the DB i,ve tried sourcing out the syntax as mention, I must be doin something wrong?