how to link a customer and a project to oneanother?
<p>I'm kind of new to PHP/MySQl so I would like some guidelines on how these thing work, hard to google this...</p>

<p>So, im trying to learn php/mysql and I'm about to write a small page with customers and each customer could have a few projects.</p>

<p>so, my db is set up as follows (guess this would need heavy modifications):
- customers (id, name, description)
- projects (id, name, description)
- users (id, name )</p>

<pre><code>&lt;?php

if(isset($_GET['id'])) {

$query = "SELECT * FROM customers WHERE id = '". $_GET['id']."'";
   $results = mysql_query($query);

   while($row = mysql_fetch_array( $results ))
   {

   echo "&lt;h3&gt;" . $row['name'] . "&lt;/h3&gt;";
   echo "&lt;br /&gt;";

$query = "SELECT * FROM projects ORDER by name ASC";
   $results = mysql_query($query);


   echo "&lt;table&gt;
            &lt;tbody&gt;";

    while($row = mysql_fetch_array( $results ))
   {
   echo "&lt;tr&gt;
  &lt;td&gt;&lt;a href='main.php?id=" . $row['id'] . "'&gt;" . $row['name'] . "&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;" . $row['description'] . "&lt;/td&gt;
        &lt;/tr&gt;";
   }
   echo "&lt;/tbody&gt;
   &lt;/table&gt;";

}

} else {

$query = "SELECT * FROM customers ORDER by name ASC";
   $results = mysql_query($query);

   echo "&lt;table&gt;
         &lt;thead&gt;
          &lt;tr&gt;
            &lt;th width='20%'&gt;Customer&lt;/th&gt;
            &lt;th width='80%'&gt;Description&lt;/th&gt;   
          &lt;/tr&gt;
        &lt;/thead&gt;
        &lt;tbody&gt;";

while($row = mysql_fetch_array( $results ))
   {
   echo "&lt;tr&gt;
  &lt;td&gt;&lt;a href='main.php?id=" . $row['id'] . "'&gt;" . $row['name'] . "&lt;/a&gt;&lt;/td&gt;
  &lt;td&gt;" . $row['description'] . "&lt;/td&gt;
        &lt;/tr&gt;";
   }
   echo "&lt;/tbody&gt;
   &lt;/table&gt;";
}
?&gt;
</code></pre>

<p>As you can see it missing some heavy things, for instance, if I choose Customer A or B I receive the same projects, I don't know how to separate the projects and "bind" them to a certain customer. And my intention is to "bind" users to projects and customers as well.</p>

<p>Any hints into the correct direction is appreciated!</p>
