• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

joining 2 tables and select data with $_get function

Explorer ,
Jan 24, 2023 Jan 24, 2023

Copy link to clipboard

Copied

Hi all,

Screen Shot 2023-01-25 at 9.58.08.png

Screen Shot 2023-01-25 at 9.58.30.png

Screen Shot 2023-01-25 at 9.58.51.png

Screen Shot 2023-01-25 at 9.59.58.png

 How can i join 2 tables with a condition that product.menu_type = ClothingType.menu_type  = $menu_type?

Views

114

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2023 Jan 25, 2023

Copy link to clipboard

Copied

The AND in your statement doesn't make sense and seems to be incomplete. It just says "Product.menu_type =". Have you tried running your query with that statement complete or without the AND clause to see what happens?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 25, 2023 Jan 25, 2023

Copy link to clipboard

Copied

LATEST

Maybe I don't correctly understand your question, but it seems to me that you are confusing two equality principles that you are trying to pass at the join level, in fact, if I undesratnd quite well, there are two types of equality, one at the join level, but a second at the query level;

try with this type of query and let us know if it matches your expectation;

 

$sql ="SELECT Product.id, Product.menu_type, Product.name, Product.price, Product.Pic, ClothingType.menu_type FROM Product INNER JOIN ClothingType ON Product.menu_type=ClothingType.menu_type WHERE Product.menu_type =".$menu_type;

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines