Hi all, I am assuming this is possible but I have been searching and trying things all day with no luck.
If I have 2 or more tables both with an id column and I want to select both of those id column’s with an inner join and put them into an array, how would I do this? I am getting errors saying I have undefined indexes. Here is some of the code to show what I am talking about
$result = mysqli_query($link, 'SELECT drinks.id, drinks.name, promo, visible, price.id, price FROM drinks
INNER JOIN price ON priceid = price.id');
Another question…Can I use the above method to also include categories? i.e. have the drinks and prices displayed within their categories, all on one page. I feel i’m not explaining this very well, what I want to achieve is:
Category name 1
Drink 1 - Price 1
Drink 2 - Price 2
Category name 2
Drink 1 - Price 1
Drink 2 - Price 2
$result = mysqli_query($link, 'SELECT drinks.id, drinks.name AS drinksname, promo, visible, price,
category.name AS categoryname FROM drinks
INNER JOIN price ON priceid = price.id
INNER JOIN drinkscategory ON drinksid = drinks.id
INNER JOIN category ON categoryid = category.id');