left join help or alternatives
let me explain what i have set up
i have a product detail page that shows the product details and the sizes, the sizes a pulled in from a table
i have the following table joined
prod table
ID (prod)
name
CatID
Size Table
SizeID
Size
Stock Table
StockID
ID (prod)
SizeID
Stock
i have a select list that gets the sizes for each product
<option value="Select Size">Select Size</option>
<?php
$query2 = sprintf("
SELECT DISTINCT
stock.StockID, size.Size
FROM
beauProd AS prod
LEFT JOIN beauStock AS stock ON prod.ID = stock.ID
LEFT JOIN beauSizeList AS size ON stock.SizeID = size.SizeID
WHERE
prod.ID = '%s' AND stock.Stock > 0
ORDER BY
size.SizeID ASC", GetSQLValueString($var1_Recordset1, "int"));
$results2 = mysql_query($query2);
while($row2 = mysql_fetch_array($results2)){
?>
<option value="<?php echo $row2['Size']; ?>"><?php echo $row2['Size']; ?></option>
<?php
}
?>
</select>
i want to know if there is another way of getting this acheived. The reason i ask is because someone else done this code and need to understand it or recreate it using this or another method.
thanks in advance
