Hi there at the moment i am using 2 select statements. a) to pull out all the product id’s where a manufacturer id = $_GET… and b) to pull out all the product names out of a language table where the product id = y (what ever i got out of the first statement). This is the only way i was able to get around the problem i had. The issue is that the second statement is in a while loop and i can’t order the results alphabetically.
Here is the code:
<?php
$r3 = mysql_query("SELECT `id_product` FROM `pl_product` WHERE id_manufacturer='".$_GET['id_manufacturer']."'");
while ($row = mysql_fetch_object($r3))
{
$prod_id = $row->id_product;
$r4 = mysql_query("SELECT `name` FROM pl_product_lang WHERE id_product='".$prod_id."' AND id_lang = 1 ORDER BY `name` ASC");
while ($row = mysql_fetch_object($r4))
{
$prod_name = $row->name;
$manu_id = $_GET['id_manufacturer']
?>
<option value="<?php echo $manu_id;?>"><?php echo $prod_name; ?></option>
<?php
}
}
?>
I know there is a single statement i can use, presumeably with a JOIN, i just can’t seem to get it working… this is what i have:
$r3 = mysql_query("SELECT `pl_product.id_product`, `pl_product_lang.name` FROM `pl_product` WHERE `pl_product.id_manufacturer`='".$_GET['id_manufacturer']."' INNER JOIN `pl_product_lang` ON `pl_product.id_product` = `pl_product_lang.id_product`");
while ($row = mysql_fetch_object($r3))
{
$prod_name = $row->pl_product_lang.name;
$manu_id = $_GET['id_manufacturer'];
}
Please point me in the right direction.
Thanks in advance.