Hi,
I think by now I have the right syntax for joining 3 tables, but please correct me if it is wrong.
The tables I am joining a as follows:
PRODUKTER (GENERAL PRODUCT INFORMATION)
VARE_TYPE (SHIRTS, JEANS ETC)
SIZES (PRODUCT SIZES)
What I want to do is to let the admin update stock for his shop in one query where I am joining these 3 tables.
I am not sure what result-set i get in return or how to get it actually.
This is what I have: (which gives me an empty result set?)
function lager_styring($connection)
{
if (isset($_GET['produkt_id']))
{
$P_ID = mysqli_real_escape_string($connection, $_GET['produkt_id']);
}
$get_produkt_info = mysqli_query($connection, "
SELECT produkter.id, produkter.brand_id, produkter.varetype_id, produkter.stock
INNER JOIN vare_type ON (produkter.varetype_id = vare_type.id)
INNER JOIN sizes on (produkter.id = sizes.produkt_id)
WHERE produkter.id = '".$P_ID."'");
while ($produkt_row = mysqli_fetch_array($get_produkt_info))
{
echo 'Produkt Id = '.$produkt_row['id'].'<br />'; // From produkter
echo 'Produkt Brand Id = '.$produkt_row['brand_id'].'<br />'; // From produkter
echo 'Produkt Vare type Id = '.$produkt_row['varetype_id'].'<br />'; // From produkter
echo 'Produkt On Stock = '.$produkt_row['stock'].'<br />'; // From produkter
echo 'Produkt name = '.$produkt_row['navn'].'<br />'; // From vare_type (Jeans, shirts)
echo 'Produkt Sizes = '.$produkt_row['size'].'<br />'; // All sizes from the sizes table
}
I get this warning, but need help to get the resutlset - Am I way off?
Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in C:\wamp\www\newshop\backend\functions\functions.php on line 317
}