MYSQL Join two tables through relationtable

I need some help for a voluntary project at my school. I am creating a database + web-userinterface for the electrical engineering workshop which is basically a inventory database whith a few gimmicks. Due to the fact that I'm at a German school the database will have German words in it I hope it does not prevent us from finding a solution.

So basically there are two tables which are connected via a relationship table (many to many relation). The one table contains all materials you can find in the workshop with its attributes like productnumber (PK), storage place, quantity, and much more and the second table is a table about the projects you can work on in the workshop for example a inverter, or a continuity tester its attributes are projectnumber (PK), projectname, and which classes do this project. The relationship table contains the PK's of the two other tables and the quantity of the materials you need for one project

My goal is now that when I choose a project it shows me all materials and how many of them I need for the project.

These are my tables:

Materials (name: material)

Projects (name: lernsituationprojekt)

Relationship-table (name: materialbenoetigt)

$sql2 = "SELECT material.* from material m, materialbenoetigt mb, lernsituationprojekt l where  m.produktnr = mb.produktnr and mb.lernsituationnr = l.lernsituationnr";

foreach ($pdo->query($sql2) as $row)
  "<tr class='table_list_content'>".
    "<td>". $row['produkt-nr']. "</td>".
    "<td>". $row['einheit']. "</td>".
    "<td>". $row['gebinde']. "</td>".
    "<td>". $row['vpe']. "</td>".
    "<td>". $row['verkaeufer']. "</td>".
    "<td>". $row['typenbezeichnung']. "</td>".
    "<td>". $row['hersteller']. "</td>".
    "<td>". $row['soll-menge']. "</td>".
    "<td>". $row['ist-menge']. "</td>".
    "<td>". $row['speicherort-foto']. "</td>".
    "<td>". $row['raum-nr']. "</td>".
    "<td>". $row['schrank-nr']. "</td>".
    "<td>". $row['fach-nr']. "</td>".