title: How to display multiple tables based on value
body: <p>I have an inventory page that displays my information, I'm attempting to have multiple tables that are based on department value, basically I want to display each department in tables by themselves rather than a single table, seems like it would make the page easier to view, yes I'm a new, yes I'm using mysql, I know its deprecated blah blah blah, this is a local db and I'm self-taught. Do I have to use some kind of loop or is there an easier way? </p>
  
  <pre><code>&lt;?php
     $connect = mysql_connect("localhost", "Me", "password") or die ("Check your connection.");
     mysql_select_db("radio");
     $quey1="select * from inventory order by department, user";
     $result=mysql_query($quey1) or die(mysql_error());
  ?&gt;
  &lt;table border=1 cellpadding="10 cellspacing="1 style="background-color:#F0F8FF;" &gt;
   &lt;tr&gt;
    &lt;th&gt;Serial Number&lt;/th&gt;
    &lt;th&gt;Model&lt;/th&gt;
    &lt;th&gt;Department&lt;/th&gt;
    &lt;th&gt;User&lt;/th&gt;
    &lt;th&gt;Date&lt;/th&gt;
   &lt;/tr&gt;
  &lt;?php
     while($row=mysql_fetch_array($result)){
        echo "&lt;tr&gt;&lt;td&gt;";
        echo $row['serialnumber'];
        echo "&lt;/td&gt;&lt;td&gt;";
        echo $row['model'];
        echo "&lt;/td&gt;&lt;td&gt;";
        echo $row['department'];
        echo "&lt;/td&gt;&lt;td&gt;";
        echo $row['user'];
        echo "&lt;/td&gt;&lt;td&gt;";
        echo $row['date'];
        echo "&lt;/td&gt;&lt;/tr&gt;";
     }
     echo "&lt;/table&gt;";
  ?&gt;
  </code></pre>