<?
/*
The UNION command is used to select related information from two tables, 
much like the JOIN command. However, when using the UNION command all 
selected columns need to be of the same data type.
List all different student names in my php  and database class:
*/
$db = mysql_connect("localhost", "mmaaaco_ksecor", "hamilton");
mysql_select_db("mmaaaco_mydb",$db);
$result = mysql_query("SELECT name FROM students_mm3304
UNION
SELECT name FROM students_mm3323",$db);

			
?>
<table>
	<tr><td colspan="4"><a name="top"><h3>Student Practice Queries</h3></a>
</td>
	</tr>
	<tr>
	<th align="left">Name</th>
	</tr>
 <? 
 // display list if there are records to display. The %s is a placeholder for each field you select below
 	if ($myrow = @mysql_fetch_array($result)) {

      

      do {

        printf("<tr><td>%s</td></tr>\n",
         $myrow["name"]);

      } 
      while ($myrow = mysql_fetch_array($result));
  }
  ?>
  </table>    