Hi all,
How can I make this nonsens i have written work?
I have 2 tables, one containing the urls I need to echo out in links - But I am not echoing out all of them. First I have to check in another table if there are any products in stock.
So I wanted to create a JOIN that could check the table with stock info.
I just havent used joins much before, and below u can probably see why..
(Normally I create a million on single select queries and store the results in variables because I am making mistakes every time I try to use joins..- but got to learn it to minimize code)
Hopefully someone can see what I am trying to do here:
$sql = mysqli_query($connection, "
SELECT url, link, varetype_id FROM produkt_navigation
INNER JOIN produkter ON produkt_navigation.brand_id = produkter.brand_id
AND produkt_navigation.varetype_id = produkter.varetype_id
WHERE produkter.stock > '0' ORDER BY produkter.produkt_nav_pos ASC");
while ($row = mysqli_fetch_array($sql))
{
// Set class til hhv overskrifter og produktgrupper:
if ($row['varetype_id'] == 0)
{
$class = 'class="produkt_nav_overskrift"';
}
else $class = 'class="produkt_nav"';
echo '<a href="'.$row['url'].'" '.$class.'>'.ucfirst($row['link']).'</a>';
}
Returns no result set - I know it looks weird :-)
Regards, Klemme